aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Serialization/ASTWriter.cpp
diff options
context:
space:
mode:
authorErich Keane <ekeane@nvidia.com>2025-09-04 13:30:22 -0700
committerGitHub <noreply@github.com>2025-09-04 13:30:22 -0700
commit1a16bc13fe47bf77013b9b5d66a15139d1bb68eb (patch)
tree6ea2bae0e111490baf69e1ad89a78cd11c8324e7 /clang/lib/Serialization/ASTWriter.cpp
parent93373446b267c877019d95e14109df21f12476c6 (diff)
downloadllvm-1a16bc13fe47bf77013b9b5d66a15139d1bb68eb.zip
llvm-1a16bc13fe47bf77013b9b5d66a15139d1bb68eb.tar.gz
llvm-1a16bc13fe47bf77013b9b5d66a15139d1bb68eb.tar.bz2
[OpenACC][NFCI] Split up the init and decl from OpenACC recipes (#156938)
Expressions/references with 'bounds' are going to need to do initialization significantly differently, so we need to have the initializer and the declaration 'separate' in the future. This patch splits the AST node into two, and normalizes them a bit. Additionally, since this required significant work on the recipe generation, this patch also does a bit of a refactor to improve readability and future expansion, now that we have a good understanding of how these are going to look.
Diffstat (limited to 'clang/lib/Serialization/ASTWriter.cpp')
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 293b67a..8e219e5 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -8751,8 +8751,11 @@ void ASTRecordWriter::writeOpenACCClause(const OpenACCClause *C) {
writeSourceLocation(PC->getLParenLoc());
writeOpenACCVarList(PC);
- for (VarDecl *VD : PC->getInitRecipes())
- AddDeclRef(VD);
+ for (const OpenACCPrivateRecipe &R : PC->getInitRecipes()) {
+ static_assert(sizeof(R) == 2 * sizeof(int *));
+ AddDeclRef(R.AllocaDecl);
+ AddStmt(const_cast<Expr *>(R.InitExpr));
+ }
return;
}
case OpenACCClauseKind::Host: {
@@ -8773,7 +8776,9 @@ void ASTRecordWriter::writeOpenACCClause(const OpenACCClause *C) {
writeOpenACCVarList(FPC);
for (const OpenACCFirstPrivateRecipe &R : FPC->getInitRecipes()) {
- AddDeclRef(R.RecipeDecl);
+ static_assert(sizeof(R) == 3 * sizeof(int *));
+ AddDeclRef(R.AllocaDecl);
+ AddStmt(const_cast<Expr *>(R.InitExpr));
AddDeclRef(R.InitFromTemporary);
}
return;
@@ -8895,8 +8900,9 @@ void ASTRecordWriter::writeOpenACCClause(const OpenACCClause *C) {
writeOpenACCVarList(RC);
for (const OpenACCReductionRecipe &R : RC->getRecipes()) {
- static_assert(sizeof(OpenACCReductionRecipe) == sizeof(int *));
- AddDeclRef(R.RecipeDecl);
+ static_assert(sizeof(OpenACCReductionRecipe) == 2 * sizeof(int *));
+ AddDeclRef(R.AllocaDecl);
+ AddStmt(const_cast<Expr *>(R.InitExpr));
}
return;
}