[PATCH] D60465: [ASTImporter] Error handling fix in ImportDefinition_New.
Balázs Kéri via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 9 08:11:47 PDT 2019
balazske updated this revision to Diff 194333.
balazske added a comment.
- Removed unneeded and wrong type cast.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60465/new/
https://reviews.llvm.org/D60465
Files:
lib/AST/ASTImporter.cpp
Index: lib/AST/ASTImporter.cpp
===================================================================
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -8382,17 +8382,16 @@
}
Error ASTImporter::ImportDefinition_New(Decl *From) {
- Decl *To = Import(From);
- if (!To)
- return llvm::make_error<ImportError>();
+ Decl *To;
+ if (Error Err = importInto(To, From))
+ return Err;
- auto *FromDC = cast<DeclContext>(From);
ASTNodeImporter Importer(*this);
if (auto *ToRecord = dyn_cast<RecordDecl>(To)) {
if (!ToRecord->getDefinition()) {
return Importer.ImportDefinition(
- cast<RecordDecl>(FromDC), ToRecord,
+ cast<RecordDecl>(From), ToRecord,
ASTNodeImporter::IDK_Everything);
}
}
@@ -8400,14 +8399,14 @@
if (auto *ToEnum = dyn_cast<EnumDecl>(To)) {
if (!ToEnum->getDefinition()) {
return Importer.ImportDefinition(
- cast<EnumDecl>(FromDC), ToEnum, ASTNodeImporter::IDK_Everything);
+ cast<EnumDecl>(From), ToEnum, ASTNodeImporter::IDK_Everything);
}
}
if (auto *ToIFace = dyn_cast<ObjCInterfaceDecl>(To)) {
if (!ToIFace->getDefinition()) {
return Importer.ImportDefinition(
- cast<ObjCInterfaceDecl>(FromDC), ToIFace,
+ cast<ObjCInterfaceDecl>(From), ToIFace,
ASTNodeImporter::IDK_Everything);
}
}
@@ -8415,12 +8414,15 @@
if (auto *ToProto = dyn_cast<ObjCProtocolDecl>(To)) {
if (!ToProto->getDefinition()) {
return Importer.ImportDefinition(
- cast<ObjCProtocolDecl>(FromDC), ToProto,
+ cast<ObjCProtocolDecl>(From), ToProto,
ASTNodeImporter::IDK_Everything);
}
}
- return Importer.ImportDeclContext(FromDC, true);
+ if (auto *FromDC = dyn_cast<DeclContext>(From))
+ return Importer.ImportDeclContext(FromDC, true);
+
+ return Error::success();
}
void ASTImporter::ImportDefinition(Decl *From) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60465.194333.patch
Type: text/x-patch
Size: 1936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190409/c0cad520/attachment.bin>
More information about the cfe-commits
mailing list