1 // RUN: %clang_cc1 %s -fopenacc -ast-dump | FileCheck %s
4 // RUN: %clang_cc1 %s -fopenacc -emit-pch -o %t %s
5 // RUN: %clang_cc1 %s -fopenacc -include-pch %t -ast-dump-all | FileCheck %s
12 struct CorrectConvert
{
18 // CHECK: FunctionDecl{{.*}}NormalUses
19 // CHECK-NEXT: CompoundStmt
21 #pragma acc parallel loop num_gangs(some_int(), some_long(), some_short())
22 for (unsigned i
= 0; i
< 5; ++i
);
23 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
24 // CHECK-NEXT: num_gangs clause
25 // CHECK-NEXT: CallExpr{{.*}}'int'
26 // CHECK-NEXT: ImplicitCastExpr{{.*}}'int (*)()' <FunctionToPointerDecay>
27 // CHECK-NEXT: DeclRefExpr{{.*}}'int ()' lvalue Function{{.*}} 'some_int' 'int ()'
28 // CHECK-NEXT: CallExpr{{.*}}'long'
29 // CHECK-NEXT: ImplicitCastExpr{{.*}}'long (*)()' <FunctionToPointerDecay>
30 // CHECK-NEXT: DeclRefExpr{{.*}}'long ()' lvalue Function{{.*}} 'some_long' 'long ()'
31 // CHECK-NEXT: CallExpr{{.*}}'short'
32 // CHECK-NEXT: ImplicitCastExpr{{.*}}'short (*)()' <FunctionToPointerDecay>
33 // CHECK-NEXT: DeclRefExpr{{.*}}'short ()' lvalue Function{{.*}} 'some_short' 'short ()'
34 // CHECK-NEXT: ForStmt
37 #pragma acc kernels loop num_gangs(some_int())
38 for (unsigned i
= 0; i
< 5; ++i
);
39 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} kernels loop
40 // CHECK-NEXT: num_gangs clause
41 // CHECK-NEXT: CallExpr{{.*}}'int'
42 // CHECK-NEXT: ImplicitCastExpr{{.*}}'int (*)()' <FunctionToPointerDecay>
43 // CHECK-NEXT: DeclRefExpr{{.*}}'int ()' lvalue Function{{.*}} 'some_int' 'int ()'
44 // CHECK-NEXT: ForStmt
48 template<typename T
, typename U
>
49 void TemplUses(T t
, U u
) {
50 // CHECK-NEXT: FunctionTemplateDecl
51 // CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 0 T
52 // CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 1 U
53 // CHECK-NEXT: FunctionDecl{{.*}} TemplUses 'void (T, U)'
54 // CHECK-NEXT: ParmVarDecl{{.*}} t 'T'
55 // CHECK-NEXT: ParmVarDecl{{.*}} u 'U'
56 // CHECK-NEXT: CompoundStmt
58 #pragma acc kernels loop num_gangs(u)
59 for (unsigned i
= 0; i
< 5; ++i
);
60 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} kernels loop
61 // CHECK-NEXT: num_gangs clause
62 // CHECK-NEXT: DeclRefExpr{{.*}} 'U' lvalue ParmVar{{.*}} 'u' 'U'
63 // CHECK-NEXT: ForStmt
66 #pragma acc parallel loop num_gangs(u, U::value)
67 for (unsigned i
= 0; i
< 5; ++i
);
68 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
69 // CHECK-NEXT: num_gangs clause
70 // CHECK-NEXT: DeclRefExpr{{.*}} 'U' lvalue ParmVar{{.*}} 'u' 'U'
71 // CHECK-NEXT: DependentScopeDeclRefExpr{{.*}} '<dependent type>' lvalue
72 // CHECK-NEXT: NestedNameSpecifier TypeSpec 'U'
73 // CHECK-NEXT: ForStmt
76 // Check the instantiated versions of the above.
77 // CHECK-NEXT: FunctionDecl{{.*}} used TemplUses 'void (CorrectConvert, HasInt)' implicit_instantiation
78 // CHECK-NEXT: TemplateArgument type 'CorrectConvert'
79 // CHECK-NEXT: RecordType{{.*}} 'CorrectConvert'
80 // CHECK-NEXT: CXXRecord{{.*}} 'CorrectConvert'
81 // CHECK-NEXT: TemplateArgument type 'HasInt'
82 // CHECK-NEXT: RecordType{{.*}} 'HasInt'
83 // CHECK-NEXT: CXXRecord{{.*}} 'HasInt'
84 // CHECK-NEXT: ParmVarDecl{{.*}} t 'CorrectConvert'
85 // CHECK-NEXT: ParmVarDecl{{.*}} u 'HasInt'
86 // CHECK-NEXT: CompoundStmt
88 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} kernels loop
89 // CHECK-NEXT: num_gangs clause
90 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'char' <UserDefinedConversion>
91 // CHECK-NEXT: CXXMemberCallExpr{{.*}}'char'
92 // CHECK-NEXT: MemberExpr{{.*}} '<bound member function type>' .operator char
93 // CHECK-NEXT: DeclRefExpr{{.*}} 'HasInt' lvalue ParmVar
94 // CHECK-NEXT: ForStmt
97 // CHECK-NEXT: OpenACCCombinedConstruct{{.*}} parallel loop
98 // CHECK-NEXT: num_gangs clause
99 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'char' <UserDefinedConversion>
100 // CHECK-NEXT: CXXMemberCallExpr{{.*}}'char'
101 // CHECK-NEXT: MemberExpr{{.*}} '<bound member function type>' .operator char
102 // CHECK-NEXT: DeclRefExpr{{.*}} 'HasInt' lvalue ParmVar
103 // CHECK-NEXT: ImplicitCastExpr{{.*}} 'int' <LValueToRValue>
104 // CHECK-NEXT: DeclRefExpr{{.*}} 'const int' lvalue Var{{.*}} 'value' 'const int'
105 // CHECK-NEXT: NestedNameSpecifier TypeSpec 'HasInt'
106 // CHECK-NEXT: ForStmt
112 using ShortTy
= short;
113 static constexpr int value
= 1;
119 TemplUses
<CorrectConvert
, HasInt
>({}, {});