[clang] [OpenACC] Loop construct basic Sema and AST work (PR #93742)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu May 30 06:36:23 PDT 2024
================
@@ -0,0 +1,164 @@
+
+// RUN: %clang_cc1 %s -fopenacc -ast-dump | FileCheck %s
+
+// Test this with PCH.
+// RUN: %clang_cc1 %s -fopenacc -emit-pch -o %t %s
+// RUN: %clang_cc1 %s -fopenacc -include-pch %t -ast-dump-all | FileCheck %s
+
+#ifndef PCH_HELPER
+#define PCH_HELPER
+
+void NormalFunc() {
+ // CHECK-LABEL: NormalFunc
+ // CHECK-NEXT: CompoundStmt
+
+#pragma acc loop
+ for(;;);
+ // CHECK-NEXT: OpenACCLoopConstruct{{.*}} <orphan>
+ // CHECK-NEXT: ForStmt
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: NullStmt
+
+ int array[5];
+ // CHECK-NEXT: DeclStmt
+ // CHECK-NEXT: VarDecl
+#pragma acc loop
+ for(auto x : array){}
+ // CHECK-NEXT: OpenACCLoopConstruct{{.*}} <orphan>
+ // CHECK-NEXT: CXXForRangeStmt
+ // CHECK: CompoundStmt
+
+#pragma acc parallel
+ // CHECK-NEXT: OpenACCComputeConstruct {{.*}}parallel
+ // CHECK-NEXT: CompoundStmt
+ {
+#pragma acc parallel
+ // CHECK-NEXT: OpenACCComputeConstruct [[PAR_ADDR:[0-9a-fx]+]] {{.*}}parallel
+ // CHECK-NEXT: CompoundStmt
+ {
+#pragma acc loop
+ for(;;);
+ // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: [[PAR_ADDR]]
+ // CHECK-NEXT: ForStmt
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: <<<NULL>>>
+ // CHECK-NEXT: NullStmt
+ }
+ }
+}
+
+template<typename T>
+void TemplFunc() {
+ // CHECK-LABEL: FunctionTemplateDecl {{.*}}TemplFunc
+ // CHECK-NEXT: TemplateTypeParmDecl
+ // CHECK-NEXT: FunctionDecl{{.*}}TemplFunc
+ // CHECK-NEXT: CompoundStmt
+
+#pragma acc loop
+ // CHECK-NEXT: OpenACCLoopConstruct{{.*}} <orphan>
+ for(typename T::type t = 0; t < 5;++t) {
+ // CHECK-NEXT: ForStmt
+ // CHECK-NEXT: DeclStmt
+ // CHECK-NEXT: VarDecl{{.*}} referenced t 'typename T::type'
+ // CHECK-NEXT: IntegerLiteral {{.*}} 'int' 0
+ // CHECK-NEXT: <<<NULL>>
+ // CHECK-NEXT: BinaryOperator{{.*}} '<dependent type>' '<'
+ // CHECK-NEXT: DeclRefExpr {{.*}} 'typename T::type' lvalue Var
+ // CHECK-NEXT: IntegerLiteral {{.*}} 'int' 5
+ // CHECK-NEXT: UnaryOperator{{.*}} '<dependent type>' lvalue prefix '++'
+ // CHECK-NEXT: DeclRefExpr {{.*}} 'typename T::type' lvalue Var
+ // CHECK-NEXT: CompoundStmt
+ typename T::type I;
+ // CHECK-NEXT: DeclStmt
+ // CHECK-NEXT: VarDecl{{.*}} I 'typename T::type'
+
+ }
+
+#pragma acc parallel
+ {
+ // CHECK-NEXT: OpenACCComputeConstruct {{.*}}parallel
+ // CHECK-NEXT: CompoundStmt
+#pragma acc parallel
+ {
+ // CHECK-NEXT: OpenACCComputeConstruct [[PAR_ADDR_UNINST:[0-9a-fx]+]] {{.*}}parallel
+ // CHECK-NEXT: CompoundStmt
+#pragma acc loop
+ // CHECK-NEXT: OpenACCLoopConstruct{{.*}} parent: [[PAR_ADDR_UNINST]]
----------------
erichkeane wrote:
There, fixed :)
https://github.com/llvm/llvm-project/pull/93742
More information about the cfe-commits
mailing list