Skip to content

Commit 300707b

Browse files
Do not set HasUpdatedBody
1 parent fe4adf2 commit 300707b

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

clang/lib/Serialization/ASTWriter.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6092,9 +6092,10 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context,
60926092

60936093
// An updated body is emitted last, so that the reader doesn't need
60946094
// to skip over the lazy body to reach statements for other records.
6095-
if (Kind == UPD_CXX_ADDED_FUNCTION_DEFINITION)
6096-
HasUpdatedBody = true;
6097-
else if (Kind == UPD_CXX_ADDED_VAR_DEFINITION)
6095+
if (Kind == UPD_CXX_ADDED_FUNCTION_DEFINITION) {
6096+
assert(isa<FunctionDecl>(D) && "expected FunctionDecl");
6097+
HasUpdatedBody = dyn_cast<FunctionDecl>(D)->hasBody();
6098+
} else if (Kind == UPD_CXX_ADDED_VAR_DEFINITION)
60986099
HasAddedVarDefinition = true;
60996100
else
61006101
Record.push_back(Kind);
@@ -6227,10 +6228,8 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context,
62276228
// Add a trailing update record, if any. These must go last because we
62286229
// lazily load their attached statement.
62296230
if (!GeneratingReducedBMI || !CanElideDeclDef(D)) {
6230-
assert(!(HasUpdatedBody && HasAddedVarDefinition) &&
6231-
"Declaration can not be both a FunctionDecl and a VarDecl");
6232-
if (const auto *Def = dyn_cast<FunctionDecl>(D);
6233-
HasUpdatedBody && Def->doesThisDeclarationHaveABody()) {
6231+
if (HasUpdatedBody) {
6232+
const auto *Def = cast<FunctionDecl>(D);
62346233
Record.push_back(UPD_CXX_ADDED_FUNCTION_DEFINITION);
62356234
Record.push_back(Def->isInlined());
62366235
Record.AddSourceLocation(Def->getInnerLocStart());

0 commit comments

Comments
 (0)