annotate clang/test/CodeGenCXX/pr18635.cpp @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -emit-llvm -std=c++11 -triple x86_64-pc-linux-gnu -o- %s | FileCheck %s
anatofuz
parents:
diff changeset
2
anatofuz
parents:
diff changeset
3 // Global @x:
anatofuz
parents:
diff changeset
4 // CHECK: [[X_GLOBAL:@[^ ]+]]{{.*}}thread_local global
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 // returned somewhere in TLS wrapper:
236
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
7 // CHECK: define {{.+}} ptr @_ZTW1x(
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
8 // CHECK: [[X_GLOBAL_ADDR:%[^ ]+]] = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 [[X_GLOBAL]])
c4bab56944e8 LLVM 16
kono
parents: 150
diff changeset
9 // CHECK: ret{{.*}}[[X_GLOBAL_ADDR]]
150
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 template <typename T> class unique_ptr {
anatofuz
parents:
diff changeset
12 template <typename F, typename S> struct pair {
anatofuz
parents:
diff changeset
13 F first;
anatofuz
parents:
diff changeset
14 S second;
anatofuz
parents:
diff changeset
15 };
anatofuz
parents:
diff changeset
16 pair<T *, int> data;
anatofuz
parents:
diff changeset
17 public:
anatofuz
parents:
diff changeset
18 constexpr unique_ptr() noexcept : data() {}
anatofuz
parents:
diff changeset
19 explicit unique_ptr(T *p) noexcept : data() {}
anatofuz
parents:
diff changeset
20 };
anatofuz
parents:
diff changeset
21
anatofuz
parents:
diff changeset
22 thread_local unique_ptr<int> x;
anatofuz
parents:
diff changeset
23 int main() { x = unique_ptr<int>(new int(5)); }