1// no PCH 2// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -emit-llvm -include %s -include %s %s -o - | FileCheck %s 3// with PCH 4// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s 5// no PCH 6// RUN: %clang_cc1 -fopenmp -emit-llvm -include %s -include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-1 7// RUN: %clang_cc1 -fopenmp -emit-llvm -include %s -include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-2 8// with PCH 9// RUN: %clang_cc1 -fopenmp -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-1 10// RUN: %clang_cc1 -fopenmp -emit-llvm -chain-include %s -chain-include %s %s -o - | FileCheck %s -check-prefix=CHECK-TLS-2 11 12#if !defined(PASS1) 13#define PASS1 14 15extern "C" int* malloc (int size); 16int *a = malloc(20); 17 18#elif !defined(PASS2) 19#define PASS2 20 21#pragma omp threadprivate(a) 22 23#else 24 25// CHECK: call {{.*}} @__kmpc_threadprivate_register( 26// CHECK-TLS-1: @{{a|\"\\01\?a@@3PE?AHE?A\"}} = {{.*}}thread_local {{.*}}global {{.*}}i32* 27 28// CHECK-LABEL: foo 29// CHECK-TLS-LABEL: foo 30int foo() { 31 return *a; 32 // CHECK: call {{.*}} @__kmpc_global_thread_num( 33 // CHECK: call {{.*}} @__kmpc_threadprivate_cached( 34 // CHECK-TLS-1: call {{.*}} @{{_ZTW1a|\"\\01\?\?__Ea@@YAXXZ\"}}() 35} 36 37// CHECK-TLS-2: define {{.*}} @{{_ZTW1a|\"\\01\?\?__Ea@@YAXXZ\"}}() 38 39#endif 40