[clang][ASTImporter] Not using consumeError at failed import of in-class initializer.

The error can be returned from the function, the problem written in comment before
does not exist. The same is done already in ASTImporter at various import failures.

After a declaration is created in an `ASTNodeImporter` import function
with `GetImportedOrCreateDecl`, that function registers it with
`MapImported`. At many places import errors can happen after this
and the error is returned. The same can be done in the place where
the in-class initializer is imported.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D122528
This commit is contained in:
Balázs Kéri 2022-04-07 10:31:09 +02:00
parent 817df7999a
commit 5479174071
1 changed files with 1 additions and 5 deletions

View File

@ -3658,11 +3658,7 @@ ExpectedDecl ASTNodeImporter::VisitFieldDecl(FieldDecl *D) {
if (!FoundField->getInClassInitializer())
FoundField->setInClassInitializer(*ToInitializerOrErr);
} else {
// We can't return error here,
// since we already mapped D as imported.
// FIXME: warning message?
consumeError(ToInitializerOrErr.takeError());
return FoundField;
return ToInitializerOrErr.takeError();
}
}
return FoundField;