[llvm-bugs] [Bug 26928] New: Prune the include path for modules

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 12 15:46:43 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26928

            Bug ID: 26928
           Summary: Prune the include path for modules
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Modules
          Assignee: unassignedclangbugs at nondot.org
          Reporter: aprantl at apple.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Currently the Darwin module self host [1] is broken because libc++ provide its
own overlay versions of libc headers which include the libc headers from the
Darwin 
module, which include other libc headers, for which clang then finds the libc++
overlays instead of the libc version.

[1] http://lab.llvm.org:8080/green/view/All/job/clang-stage2-cmake-modulesRDA/


>From the discussion in
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20151012/141031.html


>> What we really need here is a way to get the Darwin blah.h headers to
>> only include each other, and not find the libc++ headers. Do you need
>> something that works with new libc++ and old Clang, or would a Clang
>> feature to prevent the Darwin module from finding the std module's headers
>> work for you?
>>
>
> I've run into this issue in the wild with the modularized PS4 SDK, so I
> think that a clang feature that prevents this is the best fit. I think I
> may have already mentioned this to you at one of the socials but just to
> have it in writing here for everybody else, the root cause of the issue is
> that `-Imylib` will cause mylib/assert.h to be selected for `#include
> <assert.h>`, even when building the system module. Hence some random user
> header will end up as being part of the system module and the seed for
> problems has been planted.
>
> If the random user header then ends up including code from a module that
> depends on the system module, then clang will go off and build this other
> module, which itself (say) depends on the system module, which triggers the
> recursive dependency error.
>
> There's nothing special about system headers for this issue, but due to
> their position at the root of the dependency tree they seem to be the ones
> affected in practice. The fundamental problem is that some random header
> outside the module is interposing for the header listed in the module map.
> I think the feature basically needs to be about making the module more
> "hermetically sealed" in this scenario. Off the top of my head, maybe
> something like putting the module map's directory at the front of the
> search path for includes? That seems sort of hacky. Any ideas?
>

I was thinking: if we found the module map for a module in some include
path, then we should build that module with only the directories from the
header search path at or before that directory in the list of include dirs.
That's probably a fairly simple change.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160312/22eaeab6/attachment.html>


More information about the llvm-bugs mailing list