This is an archive of the discontinued LLVM Phabricator instance.

[Modules] Fix conservative assertion for import diagnostics
ClosedPublic

Authored by bruno on May 3 2017, 2:09 PM.

Details

Summary

We currenltly assert when want to diagnose a missing import and the decl in question is already visible. It turns out that the decl in question might be visible because another decl from the same module actually made the module visible in a previous error diagnostic.

Make the assertion more flexible and avoid re-exporting the module if it's already visible.

Diff Detail

Event Timeline

bruno created this revision.May 3 2017, 2:09 PM
rsmith added inline comments.May 9 2017, 12:06 PM
lib/Sema/SemaLookup.cpp
4971–4972

Decl could also now be visible due to its lexically-enclosing context having a visible merged definition. I think this assertion should either be removed or changed to something like

assert(!isVisible(Decl) || <ever created a module import for error recovery>);
bruno updated this revision to Diff 100016.May 23 2017, 3:53 PM

Updated the patch after Richard's comments. Removed the assertion but bail out early if the module is already visible.

rsmith accepted this revision.May 23 2017, 4:03 PM
This revision is now accepted and ready to land.May 23 2017, 4:03 PM
This revision was automatically updated to reflect the committed changes.