diff options
Diffstat (limited to 'test/PCH/chain-openmp-allocate.cpp')
-rw-r--r-- | test/PCH/chain-openmp-allocate.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/test/PCH/chain-openmp-allocate.cpp b/test/PCH/chain-openmp-allocate.cpp new file mode 100644 index 0000000000..d6daaff0db --- /dev/null +++ b/test/PCH/chain-openmp-allocate.cpp @@ -0,0 +1,46 @@ +// no PCH +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -ast-print -include %s -include %s %s -o - | FileCheck %s +// with PCH +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -ast-print -chain-include %s -chain-include %s %s -o - | FileCheck %s +// no PCH +// RUN: %clang_cc1 -fopenmp -ast-print -include %s -include %s %s -o - | FileCheck %s -check-prefix=CHECK-ALLOC-1 +// RUN: %clang_cc1 -fopenmp -ast-print -include %s -include %s %s -o - | FileCheck %s -check-prefix=CHECK-ALLOC-2 +// with PCH +// RUN: %clang_cc1 -fopenmp -ast-print -chain-include %s -chain-include %s %s -o - | FileCheck %s -check-prefix=CHECK-ALLOC-1 +// RUN: %clang_cc1 -fopenmp -ast-print -chain-include %s -chain-include %s %s -o - | FileCheck %s -check-prefix=CHECK-ALLOC-2 + +#if !defined(PASS1) +#define PASS1 + +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + +int a; +// CHECK: int a; + +#elif !defined(PASS2) +#define PASS2 + +#pragma omp allocate(a) allocator(omp_default_mem_alloc) +// CHECK: #pragma omp allocate(a) allocator(omp_default_mem_alloc) + +#else + +// CHECK-LABEL: foo +// CHECK-ALLOC-LABEL: foo +int foo() { + return a; + // CHECK: return a; + // CHECK-ALLOC-1: return a; +} + +// CHECK-ALLOC-2: return a; + +#endif |