[libc++] Refactor the sequence container benchmarks (#119763)
[llvm-project.git] / clang / test / SemaOpenACC / combined-construct-copy-ast.cpp
bloba696badb0847cf115c952956ac440d39c19094f1
1 // RUN: %clang_cc1 %s -fopenacc -Wno-openacc-deprecated-clause-alias -ast-dump | FileCheck %s
3 // Test this with PCH.
4 // RUN: %clang_cc1 %s -fopenacc -Wno-openacc-deprecated-clause-alias -emit-pch -o %t %s
5 // RUN: %clang_cc1 %s -fopenacc -Wno-openacc-deprecated-clause-alias -include-pch %t -ast-dump-all | FileCheck %s
7 #ifndef PCH_HELPER
8 #define PCH_HELPER
10 int Global;
11 short GlobalArray[5];
12 void NormalUses(float *PointerParam) {
13 // CHECK: FunctionDecl{{.*}}NormalUses
14 // CHECK: ParmVarDecl
15 // CHECK-NEXT: CompoundStmt
17 #pragma acc parallel loop copy(GlobalArray) pcopy(PointerParam[Global]) present_or_copy(Global)
18 for (unsigned i = 0; i < 5; ++i);
19 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
20 // CHECK-NEXT: copy clause
21 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
22 // CHECK-NEXT: pcopy clause
23 // CHECK-NEXT: ArraySubscriptExpr{{.*}}'float' lvalue
24 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'float *' <LValueToRValue>
25 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}}'PointerParam' 'float *'
26 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
27 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
28 // CHECK-NEXT: present_or_copy clause
29 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue Var{{.*}}'Global' 'int'
30 // CHECK-NEXT: ForStmt
31 // CHECK:NullStmt
34 template<auto &NTTP, typename T, typename U>
35 void TemplUses(T t, U u) {
36 // CHECK-NEXT: FunctionTemplateDecl
37 // CHECK-NEXT: NonTypeTemplateParmDecl {{.*}}referenced 'auto &' depth 0 index 0 NTTP
38 // CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 1 T
39 // CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 2 U
40 // CHECK-NEXT: FunctionDecl{{.*}} TemplUses 'void (T, U)'
41 // CHECK-NEXT: ParmVarDecl{{.*}} referenced t 'T'
42 // CHECK-NEXT: ParmVarDecl{{.*}} referenced u 'U'
43 // CHECK-NEXT: CompoundStmt
45 #pragma acc parallel loop copy(t) pcopy(NTTP, u) present_or_copy(u[0:t])
46 for (unsigned i = 0; i < 5; ++i);
47 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
48 // CHECK-NEXT: copy clause
49 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
50 // CHECK-NEXT: pcopy clause
51 // CHECK-NEXT: DeclRefExpr{{.*}}'auto' lvalue NonTypeTemplateParm{{.*}} 'NTTP' 'auto &'
52 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
53 // CHECK-NEXT: present_or_copy clause
54 // CHECK-NEXT: ArraySectionExpr
55 // CHECK-NEXT: DeclRefExpr{{.*}}'U' lvalue ParmVar{{.*}} 'u' 'U'
56 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
57 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
58 // CHECK-NEXT: ForStmt
59 // CHECK:NullStmt
61 // Check the instantiated versions of the above.
62 // CHECK-NEXT: FunctionDecl{{.*}} used TemplUses 'void (int, int *)' implicit_instantiation
63 // CHECK-NEXT: TemplateArgument decl
64 // CHECK-NEXT: Var{{.*}} 'CEVar' 'const unsigned int'
65 // CHECK-NEXT: TemplateArgument type 'int'
66 // CHECK-NEXT: BuiltinType{{.*}} 'int'
67 // CHECK-NEXT: TemplateArgument type 'int *'
68 // CHECK-NEXT: PointerType{{.*}} 'int *'
69 // CHECK-NEXT: BuiltinType{{.*}} 'int'
70 // CHECK-NEXT: ParmVarDecl{{.*}} used t 'int'
71 // CHECK-NEXT: ParmVarDecl{{.*}} used u 'int *'
72 // CHECK-NEXT: CompoundStmt
74 // #pragma acc parallel copy(t) pcopy(NTTP, u) present_or_copy(u[0:t])
75 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
76 // CHECK-NEXT: copy clause
77 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
78 // CHECK-NEXT: pcopy clause
79 // CHECK-NEXT: SubstNonTypeTemplateParmExpr{{.*}}'const unsigned int' lvalue
80 // CHECK-NEXT: NonTypeTemplateParmDecl{{.*}} referenced 'auto &' depth 0 index 0 NTTP
81 // CHECK-NEXT: DeclRefExpr{{.*}}'const unsigned int' lvalue Var{{.*}} 'CEVar' 'const unsigned int'
82 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
83 // CHECK-NEXT: present_or_copy clause
84 // CHECK-NEXT: ArraySectionExpr
85 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int *' <LValueToRValue>
86 // CHECK-NEXT: DeclRefExpr{{.*}}'int *' lvalue ParmVar{{.*}} 'u' 'int *'
87 // CHECK-NEXT: IntegerLiteral{{.*}} 'int' 0
88 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
89 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
90 // CHECK-NEXT: ForStmt
91 // CHECK:NullStmt
94 void Inst() {
95 static constexpr unsigned CEVar = 1;
96 int i;
97 TemplUses<CEVar>(i, &i);
99 #endif