• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.8 -std=c++1y -S -emit-llvm %s -o - | FileCheck %s
2 
3 // CHECK: @a = internal thread_local global
4 // CHECK: @_Z2vtIiE = linkonce_odr thread_local global i32 5
5 // CHECK: @_ZZ3inlvE3loc = linkonce_odr thread_local global i32 0
6 // CHECK: @_tlv_atexit({{.*}}@_ZN1AD1Ev
7 // CHECK: call cxx_fast_tlscc i32* @_ZTW3ext()
8 // CHECK: declare cxx_fast_tlscc i32* @_ZTW3ext()
9 // CHECK: define weak_odr hidden cxx_fast_tlscc i32* @_ZTW2vtIiE()
10 // CHECK: define weak_odr hidden cxx_fast_tlscc i32* @_ZTW2vtIvE()
11 // CHECK: define {{.*}} @_ZTW1a
12 
13 struct A {
14   ~A();
15 };
16 
17 thread_local A a;
18 
19 extern thread_local int ext;
get_ext()20 int &get_ext() { return ext; }
21 
22 template <typename T>
23 thread_local int vt = 5;
24 
get_vt()25 int get_vt() { return vt<int>; }
26 
inl()27 inline int &inl() {
28   thread_local int loc;
29   return loc;
30 }
use_inl()31 int &use_inl() { return inl(); }
32 
33 template int vt<void>;
get_vt_void()34 int &get_vt_void() { return vt<void>; }
35