This is an archive of the discontinued LLVM Phabricator instance.

[HeaderSearch] Fix processing #import-ed headers multiple times with modules enabled.
ClosedPublic

Authored by vsapsai on May 19 2020, 5:59 PM.

Details

Summary

HeaderSearch was marking requested HeaderFileInfo as Resolved only based on
the presence of ExternalSource. As the result, using any module was enough
to set ExternalSource and headers unknown to this module would have
HeaderFileInfo with empty fields, including isImport = 0, NumIncludes = 0.
Such HeaderFileInfo was preserved without changes regardless of how the
header was used in other modules and caused incorrect result in
HeaderSearch::ShouldEnterIncludeFile.

Fix by marking HeaderFileInfo as Resolved only if ExternalSource knows
about this header.

rdar://problem/62126911

Diff Detail

Event Timeline

vsapsai created this revision.May 19 2020, 5:59 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 19 2020, 5:59 PM

Ping.

Also suggested clang-format linter changes make the test useless as the order of imports is important.

vsapsai updated this revision to Diff 282035.Jul 30 2020, 1:44 PM

Rebased the change to make sure it still works.

bruno accepted this revision.Aug 18 2020, 11:43 AM

Nice catch! LGTM

This revision is now accepted and ready to land.Aug 18 2020, 11:43 AM

Thanks for the review.