On Fri, Oct 16, 2015 at 5:17 PM, Adrian Prantl via cfe-commits < cfe-commits@lists.llvm.org> wrote:
> On Oct 16, 2015, at 5:13 PM, Richard Smith <rich...@metafoo.co.uk> wrote: > > On Fri, Oct 16, 2015 at 4:48 PM, Adrian Prantl via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> On Oct 16, 2015, at 3:27 PM, Richard Smith <rich...@metafoo.co.uk> wrote: >> >> On Thu, Oct 15, 2015 at 11:14 AM, Adrian Prantl <apra...@apple.com> >> wrote: >> >>> >>> On Oct 14, 2015, at 5:07 PM, Richard Smith <rich...@metafoo.co.uk> >>> wrote: >>> >>> Ack, there are non-modular headers in the Darwin module. =( I seem to >>> recall that they're not version-locked to your compiler, so we've got to >>> support them as-is? >>> >>> If we can't turn on local submodule visibility, then we need a module >>> map for libc++ that covers all of its headers. I'll look into pruning the >>> include path when building a module from an implicitly-loaded module map. >>> >>> >>> The attached patch implements this in the most hacky way; with it I can >>> successfully compile the first few hundred files of LLVM. >>> >> >> Slightly less hacky approach attached, does this also unstick you? >> <no-undeclared-includes.diff> >> >> >> Unfortunately, no. After looking at it in the debugger, I believe the >> problem is that HeaderSearch looks >> at RequestingModule->NoUndeclaredIncludes, but the RequestingModule is a >> nullptr (while looking for cdefs.h included via assert.h, for example). >> > > I see; can you try changing the call to getModuleForLocation at the start > of Preprocessor::LookupFile to call getModuleContainingLocation instead? > (That change will break decl/use checking, but that's not hard to fix.) > > > This seems to break other things, but I do get a different result: > > In file included from <module-includes>:71: > */Volumes/Data/llvm/_build.ninja.release/bin/../lib/clang/3.8.0/include/stddef.h:118:10: > **fatal error: * > * '__stddef_max_align_t.h' file not found* > #include "__stddef_max_align_t.h" > * ^* > In file included from test.cpp:2: > In file included from > /Volumes/Data/llvm/_build.ninja.release/bin/../include/c++/v1/cassert:21: > */Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/assert.h:42:10: > **fatal error: * > * could not build module 'Darwin'* > #include <sys/cdefs.h> > * ~~~~~~~~^* > 2 errors generated. > Ha, yes, it would break that :) We need an implicit dependency on clang's _Builtin_stddef_max_align_t module to make that work. That's a pre-existing bug; try adding the attached patch.
Index: lib/Basic/Module.cpp =================================================================== --- lib/Basic/Module.cpp (revision 250139) +++ lib/Basic/Module.cpp (working copy) @@ -32,7 +32,8 @@ IsFramework(IsFramework), IsExplicit(IsExplicit), IsSystem(false), IsExternC(false), IsInferred(false), InferSubmodules(false), InferExplicitSubmodules(false), InferExportWildcard(false), - ConfigMacrosExhaustive(false), NameVisibility(Hidden) { + ConfigMacrosExhaustive(false), NoUndeclaredIncludes(false), + NameVisibility(Hidden) { if (Parent) { if (!Parent->isAvailable()) IsAvailable = false; @@ -40,6 +41,8 @@ IsSystem = true; if (Parent->IsExternC) IsExternC = true; + if (Parent->NoUndeclaredIncludes) + NoUndeclaredIncludes = true; IsMissingRequirement = Parent->IsMissingRequirement; Parent->SubModuleIndex[Name] = Parent->SubModules.size(); @@ -178,6 +181,11 @@ for (auto *Use : Top->DirectUses) if (Requested->isSubModuleOf(Use)) return true; + + // Anyone is allowed to use our builtin stddef.h and its accompanying module. + if (!Requested->Parent && Requested->Name == "_Builtin_stddef_max_align_t") + return true; + return false; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits