brintos

brintos / llvm-project-archived public Read only

0
0
Text · 717 B · c3e9e55 Raw
24 lines · cpp
1// RUN: %clang_cc1 -emit-llvm -std=c++11 -triple x86_64-pc-linux-gnu -o- %s | FileCheck %s2 3// Global @x:4// CHECK: [[X_GLOBAL:@[^ ]+]]{{.*}}thread_local global5 6// returned somewhere in TLS wrapper:7// CHECK: define {{.+}} ptr @_ZTW1x(8// CHECK: [[X_GLOBAL_ADDR:%[^ ]+]] = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 [[X_GLOBAL]])9// CHECK: ret{{.*}}[[X_GLOBAL_ADDR]]10 11template <typename T> class unique_ptr {12  template <typename F, typename S> struct pair {13    F first;14    S second;15  };16  pair<T *, int> data;17public:18  constexpr unique_ptr() noexcept : data() {}19  explicit unique_ptr(T *p) noexcept : data() {}20};21 22thread_local unique_ptr<int> x;23int main() { x = unique_ptr<int>(new int(5)); }24