-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang] fix serialization of SubstNonTypeTemplateParmExpr #134560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This fixes a couple of mistakes introduced when merging #132748 Fixes msan failure reported here: #132748 (comment)
@llvm/pr-subscribers-clang-modules @llvm/pr-subscribers-clang Author: Matheus Izvekov (mizvekov) ChangesThis fixes a couple of mistakes introduced when merging #132748 Fixes msan failure reported here: #132748 (comment) Full diff: https://github.com/llvm/llvm-project/pull/134560.diff 3 Files Affected:
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 1b6b3d06ddc1e..320fd4e2f3077 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -7011,7 +7011,7 @@ TemplateName ASTContext::getCanonicalTemplateName(TemplateName Name,
getCanonicalTemplateArgument(subst->getArgumentPack());
return getSubstTemplateTemplateParmPack(
canonArgPack, subst->getAssociatedDecl()->getCanonicalDecl(),
- subst->getFinal(), subst->getIndex());
+ subst->getIndex(), subst->getFinal());
}
case TemplateName::DeducedTemplate: {
assert(IgnoreDeduced == false);
diff --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp
index d26152f3780ed..22fe54b526433 100644
--- a/clang/lib/Serialization/ASTReaderStmt.cpp
+++ b/clang/lib/Serialization/ASTReaderStmt.cpp
@@ -2229,6 +2229,7 @@ void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
E->PackIndex = Record.readInt();
else
E->PackIndex = 0;
+ E->Final = CurrentUnpackingBits->getNextBit();
E->SubstNonTypeTemplateParmExprBits.NameLoc = readSourceLocation();
E->Replacement = Record.readSubExpr();
}
diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp
index 23bb5ff22efaf..d0a0f843c7542 100644
--- a/clang/lib/Serialization/ASTWriterStmt.cpp
+++ b/clang/lib/Serialization/ASTWriterStmt.cpp
@@ -2229,6 +2229,7 @@ void ASTStmtWriter::VisitSubstNonTypeTemplateParmExpr(
CurrentPackingBits.addBit((bool)E->getPackIndex());
if (auto PackIndex = E->getPackIndex())
Record.push_back(*PackIndex + 1);
+ CurrentPackingBits.addBit(E->getFinal());
Record.AddSourceLocation(E->getNameLoc());
Record.AddStmt(E->getReplacement());
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/81/builds/6042 Here is the relevant piece of the build log for the reference
|
Heads-up @mizvekov we have bisected a non-deterministic compilation down to this change. We're working on a reproducer. |
Dumping pcm files that occasionally differ, we always get the same diff:
so |
Okay, this is
@mizvekov - please take a look! |
Yeah I see, so this was actually missed previously in another node, |
It's possible but it's not too closely related. I will post a patch for this one soon, and then we can try again that one and I will take a fresh look on the serialization code. |
This fixes a PCM non-determinism regression reported here: #134560 (comment) There was a bit in `SubstNonTypeTemplateParmPackExpr` which we missed to serialize, and that bit eventually propagates to `SubstNonTypeTemplateParmExpr`. As a drive by, improve serialization for PackIndex on SubstNonTypeTemplateParmExpr by using the newly introduced UnsignedOrNone helpers. There are no release notes since this regression was never released.
This fixes a PCM non-determinism regression reported here: #134560 (comment) There was a bit in `SubstNonTypeTemplateParmPackExpr` which we missed to serialize, and that bit eventually propagates to `SubstNonTypeTemplateParmExpr`. As a drive by, improve serialization for PackIndex on SubstNonTypeTemplateParmExpr by using the newly introduced UnsignedOrNone helpers. There are no release notes since this regression was never released.
This will be fixed here: #135428 |
This fixes a PCM non-determinism regression reported here: #134560 (comment) There was a bit in `SubstNonTypeTemplateParmPackExpr` which we missed to serialize, and that bit eventually propagates to `SubstNonTypeTemplateParmExpr`. As a drive by, improve serialization for PackIndex on SubstNonTypeTemplateParmExpr by using the newly introduced UnsignedOrNone helpers. There are no release notes since this regression was never released.
…Expr (#135428) This fixes a PCM non-determinism regression reported here: llvm/llvm-project#134560 (comment) There was a bit in `SubstNonTypeTemplateParmPackExpr` which we missed to serialize, and that bit eventually propagates to `SubstNonTypeTemplateParmExpr`. As a drive by, improve serialization for PackIndex on SubstNonTypeTemplateParmExpr by using the newly introduced UnsignedOrNone helpers. There are no release notes since this regression was never released.
…135428) This fixes a PCM non-determinism regression reported here: llvm#134560 (comment) There was a bit in `SubstNonTypeTemplateParmPackExpr` which we missed to serialize, and that bit eventually propagates to `SubstNonTypeTemplateParmExpr`. As a drive by, improve serialization for PackIndex on SubstNonTypeTemplateParmExpr by using the newly introduced UnsignedOrNone helpers. There are no release notes since this regression was never released.
This fixes a couple of mistakes introduced when merging #132748
Fixes msan failure reported here: #132748 (comment)