@@ -6092,9 +6092,10 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context,
6092
6092
6093
6093
// An updated body is emitted last, so that the reader doesn't need
6094
6094
// 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)
6098
6099
HasAddedVarDefinition = true ;
6099
6100
else
6100
6101
Record.push_back (Kind);
@@ -6227,10 +6228,8 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context,
6227
6228
// Add a trailing update record, if any. These must go last because we
6228
6229
// lazily load their attached statement.
6229
6230
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);
6234
6233
Record.push_back (UPD_CXX_ADDED_FUNCTION_DEFINITION);
6235
6234
Record.push_back (Def->isInlined ());
6236
6235
Record.AddSourceLocation (Def->getInnerLocStart ());
0 commit comments