39 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-apple-macosx10.8 -std=c++1y -emit-llvm %s -o - | FileCheck %s2// RUN: %clang_cc1 -triple x86_64-windows-gnu -std=c++1y -emit-llvm %s -o - | FileCheck %s --check-prefix=MINGW3 4// CHECK: @a = internal thread_local global5// CHECK: @_Z2vtIiE = linkonce_odr thread_local global i32 56// CHECK: @_ZZ3inlvE3loc = linkonce_odr thread_local global i32 07// CHECK: @_tlv_atexit({{.*}}@_ZN1AD1Ev8// CHECK: call cxx_fast_tlscc ptr @_ZTW3ext()9// CHECK: declare cxx_fast_tlscc noundef ptr @_ZTW3ext()10// CHECK-DAG: define weak_odr hidden cxx_fast_tlscc noundef ptr @_ZTW2vtIiE()11// CHECK-DAG: define weak_odr hidden cxx_fast_tlscc noundef ptr @_ZTW2vtIvE()12// CHECK-DAG: define {{.*}} @_ZTW1a13 14// MINGW-DAG: define weak_odr hidden noundef ptr @_ZTW2vtIiE() {{.*}} comdat15// MINGW-DAG: define weak_odr hidden noundef ptr @_ZTW2vtIvE() {{.*}} comdat16 17struct A {18 ~A();19};20 21thread_local A a;22 23extern thread_local int ext;24int &get_ext() { return ext; }25 26template <typename T>27thread_local int vt = 5;28 29int get_vt() { return vt<int>; }30 31inline int &inl() {32 thread_local int loc;33 return loc;34}35int &use_inl() { return inl(); }36 37template int vt<void>;38int &get_vt_void() { return vt<void>; }39