Debian Codegraph @

clang/test/SemaOpenACC/data-construct-use_device-ast.cpp

raw
1 // RUN: %clang_cc1 %s -fopenacc -ast-dump | FileCheck %s
2
3 // Test this with PCH.
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
6
7 #ifndef PCH_HELPER
8 #define PCH_HELPER
9
10 int Global;
11 short GlobalArray[5];
12 void NormalUses(float *PointerParam) {
13 // CHECK: FunctionDecl{{.*}}NormalUses
14 // CHECK: ParmVarDecl
15 // CHECK-NEXT: CompoundStmt
16
17 #pragma acc host_data use_device(GlobalArray, PointerParam)
18 ;
19 // CHECK-NEXT: OpenACCHostDataConstruct{{.*}} host_data
20 // CHECK-NEXT: use_device clause
21 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'
22 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}}'PointerParam' 'float *'
23 // CHECK-NEXT: NullStmt
24 }
25
26 template<typename T>
27 void TemplUses(T t) {
28 // CHECK-NEXT: FunctionTemplateDecl
29 // CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 0 T
30 // CHECK-NEXT: FunctionDecl{{.*}} TemplUses 'void (T)'
31 // CHECK-NEXT: ParmVarDecl{{.*}} referenced t 'T'
32 // CHECK-NEXT: CompoundStmt
33
34 #pragma acc host_data use_device(t)
35 ;
36 // CHECK-NEXT: OpenACCHostDataConstruct{{.*}} host_data
37 // CHECK-NEXT: use_device clause
38 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'
39 // CHECK-NEXT: NullStmt
40
41 // Check the instantiated versions of the above.
42 // CHECK-NEXT: FunctionDecl{{.*}} used TemplUses 'void (int)' implicit_instantiation
43 // CHECK-NEXT: TemplateArgument type 'int'
44 // CHECK-NEXT: BuiltinType{{.*}} 'int'
45 // CHECK-NEXT: ParmVarDecl{{.*}} used t 'int'
46 // CHECK-NEXT: CompoundStmt
47
48 // CHECK-NEXT: OpenACCHostDataConstruct{{.*}} host_data
49 // CHECK-NEXT: use_device clause
50 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'
51 // CHECK-NEXT: NullStmt
52 }
53
54 void Inst() {
55 int i;
56 TemplUses(i);
57 }
58 #endif