summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTImporter.cpp
diff options
context:
space:
mode:
authorShafik Yaghmour <syaghmour@apple.com>2019-03-27 17:47:36 +0000
committerShafik Yaghmour <syaghmour@apple.com>2019-03-27 17:47:36 +0000
commite5094d6d3d29817d05e21cc6e34fad271b7e7d0a (patch)
tree7f77a3c6b63a244684ecc36a72499ff4c2d9534e /clang/lib/AST/ASTImporter.cpp
parentf8666b0649f8ac9624ae4b52bc50df20aa328e0a (diff)
downloadbcm5719-llvm-e5094d6d3d29817d05e21cc6e34fad271b7e7d0a.tar.gz
bcm5719-llvm-e5094d6d3d29817d05e21cc6e34fad271b7e7d0a.zip
[ASTImporter] Fix IsStructuralMatch specialization for EnumDecl to prevent re-importing an EnumDecl while trying to complete it
Summary: We may try and re-import an EnumDecl while trying to complete it in IsStructuralMatch(...) specialization for EnumDecl. This change mirrors a similar fix for the specialization for RecordDecl. Differential Revision: https://reviews.llvm.org/D59845 llvm-svn: 357100
Diffstat (limited to 'clang/lib/AST/ASTImporter.cpp')
-rw-r--r--clang/lib/AST/ASTImporter.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index dbad548b5ce..6048296fb2d 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -1946,6 +1946,12 @@ bool ASTNodeImporter::IsStructuralMatch(VarDecl *FromVar, VarDecl *ToVar,
}
bool ASTNodeImporter::IsStructuralMatch(EnumDecl *FromEnum, EnumDecl *ToEnum) {
+ // Eliminate a potential failure point where we attempt to re-import
+ // something we're trying to import while completin ToEnum
+ if (Decl *ToOrigin = Importer.GetOriginalDecl(ToEnum))
+ if (auto *ToOriginEnum = dyn_cast<EnumDecl>(ToOrigin))
+ ToEnum = ToOriginEnum;
+
StructuralEquivalenceContext Ctx(
Importer.getFromContext(), Importer.getToContext(),
Importer.getNonEquivalentDecls(), getStructuralEquivalenceKind(Importer));
OpenPOWER on IntegriCloud