1 | // RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin10.6.0 -ast-print %s -o - | 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 | FileCheck %s |
4 | // RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-linux-gnu -ast-print %s -o - | 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 -o - | FileCheck %s |
7 | |
8 | // RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -ast-print %s -o - | 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 | FileCheck %s |
11 | // RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-unknown-linux-gnu -ast-print %s -o - | 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 -o - | FileCheck %s |
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, c; |
42 | // CHECK: int a; |
43 | // CHECK: int b; |
44 | // CHECK: int c; |
45 | #pragma omp allocate(a) allocator(omp_large_cap_mem_alloc) |
46 | #pragma omp allocate(b) allocator(omp_const_mem_alloc) |
47 | // CHECK-NEXT: #pragma omp allocate(a) allocator(omp_large_cap_mem_alloc) |
48 | // CHECK-NEXT: #pragma omp allocate(b) allocator(omp_const_mem_alloc) |
49 | #pragma omp allocate(c, d) allocator(omp_high_bw_mem_alloc) |
50 | // CHECK-NEXT: #pragma omp allocate(c,d) allocator(omp_high_bw_mem_alloc) |
51 | |
52 | template <class T> |
53 | struct ST { |
54 | static T m; |
55 | #pragma omp allocate(m) allocator(omp_low_lat_mem_alloc) |
56 | }; |
57 | |
58 | template <class T> T foo() { |
59 | T v; |
60 | #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc) |
61 | v = ST<T>::m; |
62 | return v; |
63 | } |
64 | //CHECK: template <class T> T foo() { |
65 | //CHECK-NEXT: T v; |
66 | //CHECK-NEXT: #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc) |
67 | //CHECK: template<> int foo<int>() { |
68 | //CHECK-NEXT: int v; |
69 | //CHECK-NEXT: #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc) |
70 | |
71 | namespace ns{ |
72 | int a; |
73 | } |
74 | // CHECK: namespace ns { |
75 | // CHECK-NEXT: int a; |
76 | // CHECK-NEXT: } |
77 | #pragma omp allocate(ns::a) allocator(omp_pteam_mem_alloc) |
78 | // CHECK-NEXT: #pragma omp allocate(ns::a) allocator(omp_pteam_mem_alloc) |
79 | |
80 | int main () { |
81 | static int a; |
82 | // CHECK: static int a; |
83 | #pragma omp allocate(a) allocator(omp_thread_mem_alloc) |
84 | // CHECK-NEXT: #pragma omp allocate(a) allocator(omp_thread_mem_alloc) |
85 | a=2; |
86 | int b = 3; |
87 | // CHECK: int b = 3; |
88 | #pragma omp allocate(b) |
89 | // CHECK-NEXT: #pragma omp allocate(b) |
90 | return (foo<int>()); |
91 | } |
92 | |
93 | extern template int ST<int>::m; |
94 | #endif |
95 | |