[PATCH] D122528: [clang][ASTImporter] Not using consumeError at failed import of in-class initializer.
Balázs Kéri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 26 08:33:06 PDT 2022
balazske created this revision.
Herald added subscribers: steakhal, martong, gamesh411, Szelethus, dkrupp.
Herald added a reviewer: a.sidorin.
Herald added a reviewer: shafik.
Herald added a project: All.
balazske requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D122528
Files:
clang/lib/AST/ASTImporter.cpp
Index: clang/lib/AST/ASTImporter.cpp
===================================================================
--- clang/lib/AST/ASTImporter.cpp
+++ clang/lib/AST/ASTImporter.cpp
@@ -3652,13 +3652,8 @@
!FoundField->getInClassInitializer()) {
if (ExpectedExpr ToInitializerOrErr = import(FromInitializer))
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;
- }
+ else
+ return ToInitializerOrErr.takeError();
}
}
return FoundField;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122528.418395.patch
Type: text/x-patch
Size: 797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220326/61d2c2af/attachment.bin>
More information about the cfe-commits
mailing list