// RUN: cir-opt %s -verify-diagnostics -split-input-file !s32i = !cir.int module { // Global is not marked static_local_guard, but get_global is static_local cir.global "private" internal @_ZZ1fvE1x : !s32i cir.func @test_static_local_mismatch() { // expected-error @below {{static_local attribute mismatch}} %0 = cir.get_global static_local @_ZZ1fvE1x : !cir.ptr cir.return } } // ----- !s32i = !cir.int module { // Global is marked static_local_guard, but get_global is not static_local cir.global "private" internal static_local_guard<"_ZGVZ1fvE1y"> @_ZZ1fvE1y : !s32i cir.func @test_static_local_mismatch_reverse() { // expected-error @below {{static_local attribute mismatch}} %0 = cir.get_global @_ZZ1fvE1y : !cir.ptr cir.return } } // ----- !s32i = !cir.int module { // local_init is both static_local and thread_local cir.global "private" internal static_local_guard<"_ZGVZ1fvE1y"> @_ZZ1fvE1y : !s32i cir.func @test_static_local_and_tls() { %0 = cir.get_global static_local @_ZZ1fvE1y : !cir.ptr // expected-error @below {{'cir.local_init' op access to global not marked thread local}} cir.local_init thread_local @_ZZ1fvE1y ctor { cir.yield } dtor { cir.yield } cir.return } } // ----- !s32i = !cir.int module { // local_init not at function scope. cir.global "private" internal static_local_guard<"_ZGVZ1fvE1y"> @_ZZ1fvE1y : !s32i cir.global "private" internal @_AnotherGlobal = ctor : !s32i { // expected-error @below {{'cir.local_init' op expects ancestor op 'cir.func'}} cir.local_init static_local @_ZZ1fvE1y ctor { cir.yield } dtor { cir.yield } } }