Skip to content

Commit

Permalink
[OpenACC] Add Compute Context Serialization test, fix a bug
Browse files Browse the repository at this point in the history
While working on a followup patch, I discovered we didn't
serialize/deserialize the Compute Context properly, so this patch fixes
it, then adds a PCH mode to the ast test.
  • Loading branch information
erichkeane committed Mar 8, 2024
1 parent abfac56 commit c54e052
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clang/lib/Serialization/ASTReaderStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2805,7 +2805,7 @@ void ASTStmtReader::VisitOpenACCAssociatedStmtConstruct(

void ASTStmtReader::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
VisitStmt(S);
VisitOpenACCConstructStmt(S);
VisitOpenACCAssociatedStmtConstruct(S);
}

//===----------------------------------------------------------------------===//
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Serialization/ASTWriterStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2855,7 +2855,7 @@ void ASTStmtWriter::VisitOpenACCAssociatedStmtConstruct(

void ASTStmtWriter::VisitOpenACCComputeConstruct(OpenACCComputeConstruct *S) {
VisitStmt(S);
VisitOpenACCConstructStmt(S);
VisitOpenACCAssociatedStmtConstruct(S);
Code = serialization::STMT_OPENACC_COMPUTE_CONSTRUCT;
}

Expand Down
9 changes: 9 additions & 0 deletions clang/test/SemaOpenACC/compute-construct-ast.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
// 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() {
// FIXME: Add a test once we have clauses for this.
// CHECK-LABEL: NormalFunc
Expand Down Expand Up @@ -104,3 +111,5 @@ struct S {
void use() {
TemplFunc<S>();
}
#endif

0 comments on commit c54e052

Please sign in to comment.