<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 30 November 2016 at 11:08, Bruno Cardoso Lopes via Phabricator via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> I suspect the problem is instead that #import just doesn't work properly with modules<br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> (specifically, either with local submodule visibility or with modules that do not export *),<br>
<span class="">> because it doesn't care whether the previous inclusion is visible or not, and as a result it assumes<br>
> "I've heard about someone #including this ever" means the same thing as "the contents of this file<br>
> are visible right now". I know that #pragma once has this issue, so I'd expect #import to also suffer from it.<br>
<br>
</span>Taking a look at this, any ideas on what's the right approach with the #import's here? So instead of entering the header, is there a way to make the contents for the module matching the built-in header to become available/visible at that point?</blockquote><div><br></div><div>The right thing to do would be to track the set of headers whose #import / #include-with-#pragma-once is visible, and only skip inclusions if there is a *visible* #import / #include-with-#pragma-once of that header. (Much like we only skip an include due to an include guard if there is a visible definition of the include guard macro.) For instance, instead of a single `isImport` bit on `HeaderFileInfo`, we could store a list of IDs of submodules that have imported the header, and check whether any of those are visible when deciding whether to skip an inclusion, but there's probably a cheaper way (in common cases) to get the same effect.</div></div></div></div>