59 lines · cpp
1// RUN: %clang_cc1 %s -fopenacc -ast-dump | FileCheck %s2 3// Test this with PCH.4// RUN: %clang_cc1 %s -fopenacc -emit-pch -o %t %s5// RUN: %clang_cc1 %s -fopenacc -include-pch %t -ast-dump-all | FileCheck %s6 7#ifndef PCH_HELPER8#define PCH_HELPER9 10int Global;11short GlobalArray[5];12void NormalUses(float *PointerParam) {13 // CHECK: FunctionDecl{{.*}}NormalUses14 // CHECK: ParmVarDecl15 // CHECK-NEXT: CompoundStmt16 17#pragma acc host_data use_device(GlobalArray, PointerParam)18 ;19 // CHECK-NEXT: OpenACCHostDataConstruct{{.*}} host_data20 // CHECK-NEXT: use_device clause21 // CHECK-NEXT: DeclRefExpr{{.*}}'short[5]' lvalue Var{{.*}}'GlobalArray' 'short[5]'22 // CHECK-NEXT: DeclRefExpr{{.*}}'float *' lvalue ParmVar{{.*}}'PointerParam' 'float *'23 // CHECK-NEXT: NullStmt24}25 26template<typename T>27void TemplUses(T t) {28 // CHECK-NEXT: FunctionTemplateDecl29 // CHECK-NEXT: TemplateTypeParmDecl{{.*}}typename depth 0 index 0 T30 // CHECK-NEXT: FunctionDecl{{.*}} TemplUses 'void (T)'31 // CHECK-NEXT: ParmVarDecl{{.*}} referenced t 'T'32 // CHECK-NEXT: CompoundStmt33 34#pragma acc host_data use_device(t)35 ;36 // CHECK-NEXT: OpenACCHostDataConstruct{{.*}} host_data37 // CHECK-NEXT: use_device clause38 // CHECK-NEXT: DeclRefExpr{{.*}}'T' lvalue ParmVar{{.*}} 't' 'T'39 // CHECK-NEXT: NullStmt40 41 // Check the instantiated versions of the above.42 // CHECK-NEXT: FunctionDecl{{.*}} used TemplUses 'void (int)' implicit_instantiation43 // CHECK-NEXT: TemplateArgument type 'int'44 // CHECK-NEXT: BuiltinType{{.*}} 'int'45 // CHECK-NEXT: ParmVarDecl{{.*}} used t 'int'46 // CHECK-NEXT: CompoundStmt47 48 // CHECK-NEXT: OpenACCHostDataConstruct{{.*}} host_data49 // CHECK-NEXT: use_device clause50 // CHECK-NEXT: DeclRefExpr{{.*}}'int' lvalue ParmVar{{.*}} 't' 'int'51 // CHECK-NEXT: NullStmt52}53 54void Inst() {55 int i;56 TemplUses(i);57}58#endif59