1 // RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin10.6.0 -ast-print %s | FileCheck %s 2 // RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10.6.0 -x c++ -std=c++11 -emit-pch -o %t %s 3 // RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10.6.0 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print 4 // RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-linux-gnu -ast-print %s | FileCheck %s 5 // RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -x c++ -std=c++11 -emit-pch -o %t %s 6 // RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print 7 8 // RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -ast-print %s | FileCheck %s 9 // RUN: %clang_cc1 -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -x c++ -std=c++11 -emit-pch -o %t %s 10 // RUN: %clang_cc1 -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print 11 // RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-unknown-linux-gnu -ast-print %s | FileCheck %s 12 // RUN: %clang_cc1 -fopenmp-simd -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -x c++ -std=c++11 -emit-pch -o %t %s 13 // RUN: %clang_cc1 -fopenmp-simd -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print 14 // expected-no-diagnostics 15 16 #ifndef HEADER 17 #define HEADER 18 19 typedef void **omp_allocator_handle_t; 20 extern const omp_allocator_handle_t omp_default_mem_alloc; 21 extern const omp_allocator_handle_t omp_large_cap_mem_alloc; 22 extern const omp_allocator_handle_t omp_const_mem_alloc; 23 extern const omp_allocator_handle_t omp_high_bw_mem_alloc; 24 extern const omp_allocator_handle_t omp_low_lat_mem_alloc; 25 extern const omp_allocator_handle_t omp_cgroup_mem_alloc; 26 extern const omp_allocator_handle_t omp_pteam_mem_alloc; 27 extern const omp_allocator_handle_t omp_thread_mem_alloc; 28 29 struct St{ 30 int a; 31 }; 32 33 struct St1{ 34 int a; 35 static int b; 36 // CHECK: static int b; 37 #pragma omp allocate(b) allocator(omp_default_mem_alloc) 38 // CHECK-NEXT: #pragma omp allocate(St1::b) allocator(omp_default_mem_alloc){{$}} 39 } d; 40 41 int a, b; 42 // CHECK: int a; 43 // CHECK: int b; 44 #pragma omp allocate(a) allocator(omp_large_cap_mem_alloc) 45 #pragma omp allocate(a) allocator(omp_const_mem_alloc) 46 // CHECK-NEXT: #pragma omp allocate(a) allocator(omp_large_cap_mem_alloc) 47 // CHECK-NEXT: #pragma omp allocate(a) allocator(omp_const_mem_alloc) 48 #pragma omp allocate(d, b) allocator(omp_high_bw_mem_alloc) 49 // CHECK-NEXT: #pragma omp allocate(d,b) allocator(omp_high_bw_mem_alloc) 50 51 template <class T> 52 struct ST { 53 static T m; 54 #pragma omp allocate(m) allocator(omp_low_lat_mem_alloc) 55 }; 56 57 template <class T> T foo() { 58 T v; 59 #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc) 60 v = ST<T>::m; 61 return v; 62 } 63 //CHECK: template <class T> T foo() { 64 //CHECK-NEXT: T v; 65 //CHECK-NEXT: #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc) 66 //CHECK: template<> int foo<int>() { 67 //CHECK-NEXT: int v; 68 //CHECK-NEXT: #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc) 69 70 namespace ns{ 71 int a; 72 } 73 // CHECK: namespace ns { 74 // CHECK-NEXT: int a; 75 // CHECK-NEXT: } 76 #pragma omp allocate(ns::a) allocator(omp_pteam_mem_alloc) 77 // CHECK-NEXT: #pragma omp allocate(ns::a) allocator(omp_pteam_mem_alloc) 78 79 int main () { 80 static int a; 81 // CHECK: static int a; 82 #pragma omp allocate(a) allocator(omp_thread_mem_alloc) 83 // CHECK-NEXT: #pragma omp allocate(a) allocator(omp_thread_mem_alloc) 84 a=2; 85 return (foo<int>()); 86 } 87 88 extern template int ST<int>::m; 89 #endif 90