Skip to content

Commit aef000d

Browse files
authored
[clang] fix serialization of SubstNonTypeTemplateParmExpr (#134560)
This fixes a couple of mistakes introduced when merging #132748 Fixes msan failure reported here: #132748 (comment)
1 parent f2987f2 commit aef000d

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

clang/lib/AST/ASTContext.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -7011,7 +7011,7 @@ TemplateName ASTContext::getCanonicalTemplateName(TemplateName Name,
70117011
getCanonicalTemplateArgument(subst->getArgumentPack());
70127012
return getSubstTemplateTemplateParmPack(
70137013
canonArgPack, subst->getAssociatedDecl()->getCanonicalDecl(),
7014-
subst->getFinal(), subst->getIndex());
7014+
subst->getIndex(), subst->getFinal());
70157015
}
70167016
case TemplateName::DeducedTemplate: {
70177017
assert(IgnoreDeduced == false);

clang/lib/Serialization/ASTReaderStmt.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2229,6 +2229,7 @@ void ASTStmtReader::VisitSubstNonTypeTemplateParmExpr(
22292229
E->PackIndex = Record.readInt();
22302230
else
22312231
E->PackIndex = 0;
2232+
E->Final = CurrentUnpackingBits->getNextBit();
22322233
E->SubstNonTypeTemplateParmExprBits.NameLoc = readSourceLocation();
22332234
E->Replacement = Record.readSubExpr();
22342235
}

clang/lib/Serialization/ASTWriterStmt.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -2229,6 +2229,7 @@ void ASTStmtWriter::VisitSubstNonTypeTemplateParmExpr(
22292229
CurrentPackingBits.addBit((bool)E->getPackIndex());
22302230
if (auto PackIndex = E->getPackIndex())
22312231
Record.push_back(*PackIndex + 1);
2232+
CurrentPackingBits.addBit(E->getFinal());
22322233

22332234
Record.AddSourceLocation(E->getNameLoc());
22342235
Record.AddStmt(E->getReplacement());

0 commit comments

Comments
 (0)