2014-10-05 13:05:40 +08:00
|
|
|
// RUN: %clang_cc1 %s -std=c++1y -triple=i686-pc-win32 -emit-llvm -o - | FileCheck %s
|
2020-06-16 14:30:36 +08:00
|
|
|
// RUN: %clang_cc1 %s -std=c++1y -triple=i686-pc-win32 -ftls-model=local-dynamic -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-LD
|
2014-10-05 13:05:40 +08:00
|
|
|
|
|
|
|
struct A {
|
|
|
|
A();
|
|
|
|
~A();
|
|
|
|
};
|
|
|
|
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK-DAG: $"??$a@X@@3UA@@A" = comdat any
|
|
|
|
// CHECK-DAG: @"??$a@X@@3UA@@A" = linkonce_odr dso_local thread_local global %struct.A zeroinitializer, comdat, align 1
|
|
|
|
// CHECK-DAG: @"??__E?$a@X@@YAXXZ$initializer$" = internal constant void ()* @"??__E?$a@X@@YAXXZ", section ".CRT$XDU", comdat($"??$a@X@@3UA@@A")
|
2020-06-16 14:30:36 +08:00
|
|
|
// CHECK-LD-DAG: $"??$a@X@@3UA@@A" = comdat any
|
|
|
|
// CHECK-LD-DAG: @"??$a@X@@3UA@@A" = linkonce_odr dso_local thread_local(localdynamic) global %struct.A zeroinitializer, comdat, align 1
|
|
|
|
// CHECK-LD-DAG: @"??__E?$a@X@@YAXXZ$initializer$" = internal constant void ()* @"??__E?$a@X@@YAXXZ", section ".CRT$XDU", comdat($"??$a@X@@3UA@@A")
|
2014-10-05 13:05:40 +08:00
|
|
|
template <typename T>
|
|
|
|
thread_local A a = A();
|
|
|
|
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK-DAG: @"?b@@3UA@@A" = dso_local thread_local global %struct.A zeroinitializer, align 1
|
2014-10-05 13:05:40 +08:00
|
|
|
// CHECK-DAG: @"__tls_init$initializer$" = internal constant void ()* @__tls_init, section ".CRT$XDU"
|
2020-06-16 14:30:36 +08:00
|
|
|
// CHECK-LD-DAG: @"?b@@3UA@@A" = dso_local thread_local(localdynamic) global %struct.A zeroinitializer, align 1
|
|
|
|
// CHECK-LD-DAG: @"__tls_init$initializer$" = internal constant void ()* @__tls_init, section ".CRT$XDU"
|
2014-10-05 13:05:40 +08:00
|
|
|
thread_local A b;
|
|
|
|
|
|
|
|
// CHECK-LABEL: define internal void @__tls_init()
|
2018-03-17 04:36:49 +08:00
|
|
|
// CHECK: call void @"??__Eb@@YAXXZ"
|
2020-06-16 14:30:36 +08:00
|
|
|
// CHECK-LD-LABEL: define internal void @__tls_init()
|
|
|
|
// CHECK-LD: call void @"??__Eb@@YAXXZ"
|
2014-10-05 13:05:40 +08:00
|
|
|
|
|
|
|
thread_local A &c = b;
|
|
|
|
thread_local A &d = c;
|
|
|
|
|
|
|
|
A f() {
|
|
|
|
(void)a<void>;
|
|
|
|
(void)b;
|
|
|
|
return c;
|
|
|
|
}
|
2016-09-12 10:51:43 +08:00
|
|
|
|
2017-06-13 04:10:48 +08:00
|
|
|
// CHECK: !llvm.linker.options = !{![[dyn_tls_init:[0-9]+]]}
|
2016-09-12 10:51:43 +08:00
|
|
|
// CHECK: ![[dyn_tls_init]] = !{!"/include:___dyn_tls_init@12"}
|
2020-06-16 14:30:36 +08:00
|
|
|
// CHECK-LD: !llvm.linker.options = !{![[dyn_tls_init:[0-9]+]]}
|
|
|
|
// CHECK-LD: ![[dyn_tls_init]] = !{!"/include:___dyn_tls_init@12"}
|