1 // expected-no-diagnostics
3 //RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \
4 //RUN: -x c++ -std=c++14 -fexceptions -fcxx-exceptions \
5 //RUN: -Wno-source-uses-openmp -Wno-openmp-clauses \
6 //RUN: -ast-print %s | FileCheck %s --check-prefix=PRINT
8 //RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \
9 //RUN: -x c++ -std=c++14 -fexceptions -fcxx-exceptions \
10 //RUN: -Wno-source-uses-openmp -Wno-openmp-clauses \
11 //RUN: -ast-dump %s | FileCheck %s --check-prefix=DUMP
13 //RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \
14 //RUN: -x c++ -std=c++14 -fexceptions -fcxx-exceptions \
15 //RUN: -Wno-source-uses-openmp -Wno-openmp-clauses \
16 //RUN: -emit-pch -o %t %s
18 //RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \
19 //RUN: -x c++ -std=c++14 -fexceptions -fcxx-exceptions \
20 //RUN: -Wno-source-uses-openmp -Wno-openmp-clauses \
21 //RUN: -include-pch %t -ast-print %s | FileCheck %s --check-prefix=PRINT
23 //RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp \
24 //RUN: -x c++ -std=c++14 -fexceptions -fcxx-exceptions \
25 //RUN: -Wno-source-uses-openmp -Wno-openmp-clauses \
26 //RUN: -include-pch %t -ast-dump-all %s | FileCheck %s --check-prefix=DUMP
31 typedef enum omp_allocator_handle_t
{
32 omp_null_allocator
= 0,
33 omp_default_mem_alloc
= 1,
34 omp_large_cap_mem_alloc
= 2,
35 omp_const_mem_alloc
= 3,
36 omp_high_bw_mem_alloc
= 4,
37 omp_low_lat_mem_alloc
= 5,
38 omp_cgroup_mem_alloc
= 6,
39 omp_pteam_mem_alloc
= 7,
40 omp_thread_mem_alloc
= 8,
41 KMP_ALLOCATOR_MAX_HANDLE
= __UINTPTR_MAX__
42 } omp_allocator_handle_t
;
46 #pragma omp allocate(a) align(4) allocator(omp_pteam_mem_alloc)
49 // DUMP: FunctionDecl {{.*}}
50 // DUMP: DeclStmt {{.*}}
51 // DUMP: VarDecl {{.*}}a 'char'
52 // DUMP: OMPAllocateDeclAttr {{.*}}OMPPTeamMemAlloc
53 // DUMP: DeclRefExpr {{.*}}'omp_allocator_handle_t' EnumConstant {{.*}} 'omp_pteam_mem_alloc' 'omp_allocator_handle_t'
54 // DUMP: ConstantExpr {{.*}}'int'
56 // DUMP: IntegerLiteral {{.*}}'int' 4
57 // DUMP: DeclStmt {{.*}}
58 // DUMP: OMPAllocateDecl {{.*}}
59 // DUMP: DeclRefExpr {{.*}}'char' lvalue Var {{.*}} 'a' 'char'
60 // DUMP: OMPAlignClause {{.*}}
61 // DUMP: ConstantExpr {{.*}}'int'
63 // DUMP: IntegerLiteral {{.*}}'int' 4
64 // DUMP: OMPAllocatorClause {{.*}}
65 // DUMP: DeclRefExpr {{.*}}'omp_allocator_handle_t' EnumConstant {{.*}}'omp_pteam_mem_alloc' 'omp_allocator_handle_t'
66 // PRINT: #pragma omp allocate(a) align(4) allocator(omp_pteam_mem_alloc)
70 #pragma omp allocate(b) allocator(omp_low_lat_mem_alloc) align(2)
73 // DUMP: FunctionDecl {{.*}}
74 // DUMP: DeclStmt {{.*}}
75 // DUMP: VarDecl {{.*}}b 'char'
76 // DUMP: OMPAllocateDeclAttr {{.*}}Implicit OMPLowLatMemAlloc
77 // DUMP: DeclRefExpr {{.*}}'omp_allocator_handle_t' EnumConstant {{.*}} 'omp_low_lat_mem_alloc' 'omp_allocator_handle_t'
78 // DUMP: ConstantExpr {{.*}}'int'
80 // DUMP: IntegerLiteral {{.*}}'int' 2
81 // DUMP: DeclStmt {{.*}}
82 // DUMP: OMPAllocateDecl {{.*}}
83 // DUMP: DeclRefExpr {{.*}}'char' lvalue Var {{.*}} 'b' 'char'
84 // DUMP: OMPAllocatorClause {{.*}}
85 // DUMP: DeclRefExpr {{.*}}'omp_allocator_handle_t' EnumConstant {{.*}} 'omp_low_lat_mem_alloc' 'omp_allocator_handle_t'
86 // DUMP: OMPAlignClause {{.*}}
87 // DUMP: ConstantExpr {{.*}}'int'
89 // DUMP: IntegerLiteral {{.*}}'int' 2
90 // PRINT: #pragma omp allocate(b) allocator(omp_low_lat_mem_alloc) align(2)
92 template <typename T
, unsigned size
>
95 #pragma omp allocate(foo) align(size)
101 d
= run
<double, 1>();
105 // DUMP: FunctionTemplateDecl {{.*}}
106 // DUMP: TemplateTypeParmDecl {{.*}}
107 // DUMP: NonTypeTemplateParmDecl {{.*}}'unsigned int' depth 0 index 1 size
108 // DUMP: FunctionDecl {{.*}}'T ()'
109 // DUMP: DeclStmt {{.*}}
110 // DUMP: OMPAllocateDecl {{.*}}
111 // DUMP: DeclRefExpr {{.*}}'T' lvalue Var {{.*}} 'foo' 'T'
112 // DUMP: OMPAlignClause {{.*}}
113 // DUMP: DeclRefExpr {{.*}}'unsigned int' NonTypeTemplateParm {{.*}} 'size' 'unsigned int'
114 // DUMP: FunctionDecl {{.*}}run 'double ()'
115 // DUMP: TemplateArgument type 'double'
116 // DUMP: BuiltinType {{.*}}'double'
117 // DUMP: TemplateArgument integral 1
118 // DUMP: OMPAllocateDeclAttr {{.*}}Implicit OMPNullMemAlloc
119 // DUMP: ConstantExpr {{.*}}'unsigned int'
120 // DUMP: value: Int 1
121 // DUMP: SubstNonTypeTemplateParmExpr {{.*}}'unsigned int'
122 // DUMP: NonTypeTemplateParmDecl {{.*}}'unsigned int' depth 0 index 1 size
123 // DUMP: IntegerLiteral {{.*}}'unsigned int' 1
124 // DUMP: OMPAllocateDecl {{.*}}
125 // DUMP: DeclRefExpr {{.*}}'double' lvalue Var {{.*}} 'foo' 'double'
126 // DUMP: OMPAlignClause {{.*}}
127 // DUMP: ConstantExpr {{.*}}'unsigned int'
128 // DUMP: value: Int 1
129 // DUMP: SubstNonTypeTemplateParmExpr {{.*}}'unsigned int'
130 // DUMP: NonTypeTemplateParmDecl {{.*}}'unsigned int' depth 0 index 1 size
131 // DUMP: IntegerLiteral {{.*}}'unsigned int' 1
132 // PRINT: #pragma omp allocate(foo) align(size)
133 // PRINT: #pragma omp allocate(foo) align(1U)