[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / allocate_allocator_modifier_messages.cpp
blob160c4996c12195da10aae51d0c7c066e1eac94e6
1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 %s
3 typedef enum omp_allocator_handle_t {
4 omp_null_allocator = 0,
5 omp_default_mem_alloc = 1,
6 omp_large_cap_mem_alloc = 2,
7 omp_const_mem_alloc = 3,
8 omp_high_bw_mem_alloc = 4,
9 omp_low_lat_mem_alloc = 5,
10 omp_cgroup_mem_alloc = 6,
11 omp_pteam_mem_alloc = 7,
12 omp_thread_mem_alloc = 8,
13 } omp_allocator_handle_t;
15 int myAlloc() {
16 return 100;
19 int main() {
20 int a, b, c;
21 // expected-error@+4 {{expected '('}}
22 // expected-error@+3 {{expected expression}}
23 // expected-error@+2 {{expected ')'}}
24 // expected-note@+1 {{to match this '('}}
25 #pragma omp scope private(c) allocate(allocator
26 // expected-error@+6 {{expected expression}}
27 // expected-error@+5 {{expected ')'}}
28 // expected-note@+4 {{to match this '('}}
29 // expected-error@+3 {{expected expression}}
30 // expected-error@+2 {{expected ')'}}
31 // expected-note@+1 {{to match this '('}}
32 #pragma omp scope private(c) allocate(allocator(
33 // expected-error@+4 {{expected expression}}
34 // expected-error@+3 {{expected expression}}
35 // expected-error@+2 {{expected ')'}}
36 // expected-note@+1 {{to match this '('}}
37 #pragma omp scope private(c) allocate(allocator()
38 // expected-error@+2 {{expected expression}}
39 // expected-error@+1 {{expected expression}}
40 #pragma omp scope private(c) allocate(allocator())
41 // expected-error@+6 {{expected ')'}}
42 // expected-note@+5 {{to match this '('}}
43 // expected-error@+4 {{missing ':' after allocator modifier}}
44 // expected-error@+3 {{expected expression}}
45 // expected-error@+2 {{expected ')'}}
46 // expected-note@+1 {{to match this '('}}
47 #pragma omp scope private(c) allocate(allocator(omp_default_mem_alloc
48 // expected-error@+6 {{missing ':' after allocator modifier}}
49 // expected-error@+5 {{expected expression}}
50 // expected-error@+4 {{expected ')'}}
51 // expected-note@+3 {{to match this '('}}
52 // expected-error@+2 {{expected ')'}}
53 // expected-note@+1 {{to match this '('}}
54 #pragma omp scope private(c) allocate(allocator(omp_large_cap_mem_alloc:
55 // expected-error@+4 {{missing ':' after allocator modifier}}
56 // expected-error@+3 {{expected expression}}
57 // expected-error@+2 {{expected ')'}}
58 // expected-note@+1 {{to match this '('}}
59 #pragma omp scope private(c) allocate(allocator(omp_const_mem_alloc)
60 // expected-error@+2 {{missing ':' after allocator modifier}}
61 // expected-error@+1 {{expected expression}}
62 #pragma omp scope private(c) allocate(allocator(omp_high_bw_mem_alloc))
63 // expected-error@+1 {{expected expression}}
64 #pragma omp scope private(c) allocate(allocator(omp_low_lat_mem_alloc):)
65 // expected-error@+6 {{expected ')'}}
66 // expected-note@+5 {{to match this '('}}
67 // expected-error@+4 {{missing ':' after allocator modifier}}
68 // expected-error@+3 {{expected expression}}
69 // expected-error@+2 {{expected ')'}}
70 // expected-note@+1 {{to match this '('}}
71 #pragma omp scope private(c) allocate(allocator(omp_cgroup_mem_alloc:)
72 // expected-error@+4 {{expected ')'}}
73 // expected-note@+3 {{to match this '('}}
74 // expected-error@+2 {{missing ':' after allocator modifier}}
75 // expected-error@+1 {{expected expression}}
76 #pragma omp scope private(c) allocate(allocator(omp_pteam_mem_alloc:))
77 // expected-error@+4 {{expected ')'}}
78 // expected-note@+3 {{to match this '('}}
79 // expected-error@+2 {{missing ':' after allocator modifier}}
80 // expected-error@+1 {{expected expression}}
81 #pragma omp scope private(c) allocate(allocator(omp_thread_mem_alloc:c))
82 // expected-error@+1 {{expected variable name}}
83 #pragma omp scope private(c) allocate(allocator(omp_const_mem_alloc):1)
84 // expected-error@+1 {{expected variable name}}
85 #pragma omp scope private(c) allocate(allocator(omp_const_mem_alloc):-10)
86 // expected-error@+4 {{expected ',' or ')' in 'allocate' clause}}
87 // expected-error@+3 {{expected ')'}}
88 // expected-warning@+2 {{extra tokens at the end of '#pragma omp scope' are ignored}}
89 // expected-note@+1 {{to match this '('}}
90 #pragma omp scope private(a,b,c) allocate(allocator(omp_const_mem_alloc):c:b;a)
91 // expected-error@+1 {{initializing 'const omp_allocator_handle_t' with an expression of incompatible type 'int'}}
92 #pragma omp scope private(c,a,b) allocate(allocator(myAlloc()):a,b,c)
93 // expected-error@+2 {{missing ':' after allocator modifier}}
94 // expected-error@+1 {{expected expression}}
95 #pragma omp scope private(c) allocate(allocator(omp_default_mem_alloc);c)
96 ++a;