1 // RUN: %clang_cc1 -triple aarch64 -mbranch-target-enforce -msign-return-address=all -fcxx-exceptions -fexceptions -emit-llvm %s -o - | FileCheck %s
3 // Check that functions generated by clang have the correct attributes
11 // Initialization of var1 causes __cxx_global_var_init and __tls_init to be generated
12 thread_local Example var1
;
13 extern thread_local Example var2
;
16 int testfn() noexcept
{
17 // Calling fn in a noexcept function causes __clang_call_terminate to be generated
19 // Use of var1 and var2 causes TLS wrapper functions to be generated
20 return var1
.fn() + var2
.fn();
23 // CHECK: define {{.*}} @__cxx_global_var_init() [[ATTR1:#[0-9]+]]
24 // CHECK: define {{.*}} @__clang_call_terminate({{.*}}) [[ATTR2:#[0-9]+]]
25 // CHECK: define {{.*}} @_ZTW4var1() [[ATTR1]]
26 // CHECK: define {{.*}} @_ZTW4var2() [[ATTR1]]
27 // CHECK: define {{.*}} @__tls_init() [[ATTR1]]
29 // CHECK: attributes [[ATTR1]] = { {{.*}}"branch-target-enforcement" {{.*}}"sign-return-address"="all" "sign-return-address-key"="a_key"
30 // CHECK: attributes [[ATTR2]] = { {{.*}}"branch-target-enforcement" {{.*}}"sign-return-address"="all" "sign-return-address-key"="a_key"