This is an archive of the discontinued LLVM Phabricator instance.

Fix IsStructuralMatch specialization for EnumDecl to prevent re-importing an EnumDecl while trying to complete it
ClosedPublic

Authored by shafik on Mar 26 2019, 2:11 PM.

Details

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.

Diff Detail

Repository
rL LLVM

Event Timeline

shafik created this revision.Mar 26 2019, 2:11 PM

LLDB regression test that goes with this fix: https://reviews.llvm.org/D59847

JDevlieghere added inline comments.
lib/AST/ASTImporter.cpp
1951 ↗(On Diff #192354)
if (Decl *ToOrigin = Importer.GetOriginalDecl(ToEnum)) 
  if (auto *ToOriginEnum = dyn_cast<EnumDecl>(ToOrigin))
    ToEnum = ToOriginEnum;
martong accepted this revision.Mar 27 2019, 8:38 AM

LGTM!

This revision is now accepted and ready to land.Mar 27 2019, 8:38 AM
shafik updated this revision to Diff 192466.Mar 27 2019, 9:58 AM

Fixes based on comments.

shafik marked 2 inline comments as done.Mar 27 2019, 9:59 AM
shafik added inline comments.
lib/AST/ASTImporter.cpp
1951 ↗(On Diff #192354)

I normally just match the local style but this is indeed much better style.

This revision was automatically updated to reflect the committed changes.
shafik marked an inline comment as done.
Herald added a project: Restricted Project. · View Herald TranscriptMar 27 2019, 10:46 AM

Post-LGTM with some stylish nits.

cfe/trunk/lib/AST/ASTImporter.cpp
1950

completin_g_; also, comments are required to be ended with dot.