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