[PATCH] D59845: Fix IsStructuralMatch specialization for EnumDecl to prevent re-importing an EnumDecl while trying to complete it
Shafik Yaghmour via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 26 14:11:45 PDT 2019
shafik created this revision.
shafik added reviewers: martong, teemperor, friss, a_sidorin.
Herald added subscribers: jdoerfert, rnkovacs.
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`.
https://reviews.llvm.org/D59845
Files:
lib/AST/ASTImporter.cpp
Index: lib/AST/ASTImporter.cpp
===================================================================
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -1946,6 +1946,17 @@
}
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
+ Decl *ToOrigin = Importer.GetOriginalDecl(ToEnum);
+
+ if (ToOrigin) {
+ auto *ToOriginEnum = dyn_cast<EnumDecl>(ToOrigin);
+
+ if (ToOriginEnum)
+ ToEnum = ToOriginEnum;
+ }
+
StructuralEquivalenceContext Ctx(
Importer.getFromContext(), Importer.getToContext(),
Importer.getNonEquivalentDecls(), getStructuralEquivalenceKind(Importer));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59845.192354.patch
Type: text/x-patch
Size: 771 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190326/0f13be7b/attachment.bin>
More information about the cfe-commits
mailing list