<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Apr 18, 2014, at 4:41 PM, Quentin Colombet <<a href="mailto:qcolombet@apple.com">qcolombet@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Ben,<div><br></div><div>Looks like your commit broke a buildbot:</div><div><a href="http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-nobootstrap-RAincremental/builds/14603">http://lab.llvm.org:8013/builders/clang-x86_64-darwin11-nobootstrap-RAincremental/builds/14603</a></div><div><br></div><div>Could you fix it or revert?</div></div></blockquote><div><br></div><div>Already on it, thanks! Should have a fix in momentarily.</div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br></div><div>Thanks,<br><div apple-content-edited="true">
<div style="font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">-Quentin</div>
</div>
<br><div><div>On Apr 18, 2014, at 3:07 PM, Ben Langmuir <<a href="mailto:blangmuir@apple.com">blangmuir@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Author: benlangmuir<br>Date: Fri Apr 18 17:07:31 2014<br>New Revision: 206664<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=206664&view=rev">http://llvm.org/viewvc/llvm-project?rev=206664&view=rev</a><br>Log:<br>Don't build modules with (submodules with) missing headers<br><br>Unless they are in submodules that aren't available anyway, due to<br>requirements not being met. Also, mark children as unavailable when the<br>parent is.<br><br>Added:<br> cfe/trunk/test/Modules/missing-header.m<br>Modified:<br> cfe/trunk/include/clang/Basic/Module.h<br> cfe/trunk/lib/Basic/Module.cpp<br> cfe/trunk/lib/Frontend/FrontendActions.cpp<br> cfe/trunk/lib/Lex/ModuleMap.cpp<br> cfe/trunk/test/Modules/Inputs/submodules/module.map<br> cfe/trunk/test/Modules/submodules.cpp<br><br>Modified: cfe/trunk/include/clang/Basic/Module.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Module.h?rev=206664&r1=206663&r2=206664&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Module.h?rev=206664&r1=206663&r2=206664&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/Basic/Module.h (original)<br>+++ cfe/trunk/include/clang/Basic/Module.h Fri Apr 18 17:07:31 2014<br>@@ -123,8 +123,13 @@ public:<br> /// will be false to indicate that this (sub)module is not available.<br> SmallVector<Requirement, 2> Requirements;<br><br>- /// \brief Whether this module is available in the current<br>- /// translation unit.<br>+ /// \brief Whether this module is missing a feature from \c Requirements.<br>+ unsigned IsMissingRequirement : 1;<br>+<br>+ /// \brief Whether this module is available in the current translation unit.<br>+ ///<br>+ /// If the module is missing headers or does not meet all requirements then<br>+ /// this bit will be 0.<br> unsigned IsAvailable : 1;<br><br> /// \brief Whether this module was loaded from a module file.<br>@@ -407,6 +412,9 @@ public:<br> const LangOptions &LangOpts,<br> const TargetInfo &Target);<br><br>+ /// \brief Mark this module and all of its submodules as unavailable.<br>+ void markUnavailable();<br>+<br> /// \brief Find the submodule with the given name.<br> ///<br> /// \returns The submodule if found, or NULL otherwise.<br><br>Modified: cfe/trunk/lib/Basic/Module.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Module.cpp?rev=206664&r1=206663&r2=206664&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Module.cpp?rev=206664&r1=206663&r2=206664&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Basic/Module.cpp (original)<br>+++ cfe/trunk/lib/Basic/Module.cpp Fri Apr 18 17:07:31 2014<br>@@ -160,6 +160,11 @@ void Module::addRequirement(StringRef Fe<br> if (hasFeature(Feature, LangOpts, Target) == RequiredState)<br> return;<br><br>+ IsMissingRequirement = true;<br>+ markUnavailable();<br>+}<br>+<br>+void Module::markUnavailable() {<br> if (!IsAvailable)<br> return;<br><br><br>Modified: cfe/trunk/lib/Frontend/FrontendActions.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=206664&r1=206663&r2=206664&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendActions.cpp?rev=206664&r1=206663&r2=206664&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Frontend/FrontendActions.cpp (original)<br>+++ cfe/trunk/lib/Frontend/FrontendActions.cpp Fri Apr 18 17:07:31 2014<br>@@ -288,7 +288,8 @@ bool GenerateModuleAction::BeginSourceFi<br> if (!Module->isAvailable(CI.getLangOpts(), CI.getTarget(), Requirement,<br> MissingHeader)) {<br> if (MissingHeader.FileNameLoc.isValid()) {<br>- CI.getDiagnostics().Report(diag::err_module_header_missing)<br>+ CI.getDiagnostics().Report(MissingHeader.FileNameLoc,<br>+ diag::err_module_header_missing)<br> << MissingHeader.IsUmbrella << MissingHeader.FileName;<br> } else {<br> CI.getDiagnostics().Report(diag::err_module_unavailable)<br><br>Modified: cfe/trunk/lib/Lex/ModuleMap.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=206664&r1=206663&r2=206664&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ModuleMap.cpp?rev=206664&r1=206663&r2=206664&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Lex/ModuleMap.cpp (original)<br>+++ cfe/trunk/lib/Lex/ModuleMap.cpp Fri Apr 18 17:07:31 2014<br>@@ -1477,6 +1477,15 @@ void ModuleMapParser::parseModuleDecl()<br> inferFrameworkLink(ActiveModule, Directory, SourceMgr.getFileManager());<br> }<br><br>+ // If the module meets all requirements but is still unavailable, mark the<br>+ // whole tree as unavailable to prevent it from building.<br>+ if (!ActiveModule->IsAvailable && !ActiveModule->IsMissingRequirement &&<br>+ ActiveModule->Parent) {<br>+ ActiveModule->getTopLevelModule()->markUnavailable();<br>+ ActiveModule->getTopLevelModule()->MissingHeaders.append(<br>+ ActiveModule->MissingHeaders.begin(), ActiveModule->MissingHeaders.end());<br>+ }<br>+<br> // We're done parsing this module. Pop back to the previous module.<br> ActiveModule = PreviousActiveModule;<br> }<br>@@ -1705,9 +1714,8 @@ void ModuleMapParser::parseHeaderDecl(MM<br><br> // If we find a module that has a missing header, we mark this module as<br> // unavailable and store the header directive for displaying diagnostics.<br>- // Other submodules in the same module can still be used.<br> Header.IsUmbrella = LeadingToken == MMToken::UmbrellaKeyword;<br>- ActiveModule->IsAvailable = false;<br>+ ActiveModule->markUnavailable();<br> ActiveModule->MissingHeaders.push_back(Header);<br> }<br> }<br><br>Modified: cfe/trunk/test/Modules/Inputs/submodules/module.map<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/submodules/module.map?rev=206664&r1=206663&r2=206664&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/submodules/module.map?rev=206664&r1=206663&r2=206664&view=diff</a><br>==============================================================================<br>--- cfe/trunk/test/Modules/Inputs/submodules/module.map (original)<br>+++ cfe/trunk/test/Modules/Inputs/submodules/module.map Fri Apr 18 17:07:31 2014<br>@@ -15,3 +15,11 @@ module missing_headers {<br> module missing { header "missing.h" }<br> module not_missing { header "not_missing.h" }<br> }<br>+<br>+module missing_unavailable_headers {<br>+ module missing {<br>+ requires !objc<br>+ header "missing.h"<br>+ }<br>+ module not_missing { }<br>+}<br><br>Added: cfe/trunk/test/Modules/missing-header.m<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/missing-header.m?rev=206664&view=auto">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/missing-header.m?rev=206664&view=auto</a><br>==============================================================================<br>--- cfe/trunk/test/Modules/missing-header.m (added)<br>+++ cfe/trunk/test/Modules/missing-header.m Fri Apr 18 17:07:31 2014<br>@@ -0,0 +1,13 @@<br>+// RUN: rm -rf %t<br>+// RUN: not %clang_cc1 -x objective-c -fmodules-cache-path=%t -fmodules -I %S/Inputs/submodules %s 2>&1 | FileCheck %s<br>+<br>+// FIXME: cannot use -verify, because the error from inside the module build has<br>+// a different source manager than the verifier.<br>+<br>+@import missing_unavailable_headers; // OK<br>+@import missing_unavailable_headers.not_missing; // OK<br>+// CHECK-NOT: missing_unavailable_headers<br>+<br>+@import missing_headers;<br>+// CHECK: module.map:15:27: error: header 'missing.h' not found<br>+// CHECK: could not build module 'missing_headers'<br><br>Modified: cfe/trunk/test/Modules/submodules.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodules.cpp?rev=206664&r1=206663&r2=206664&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodules.cpp?rev=206664&r1=206663&r2=206664&view=diff</a><br>==============================================================================<br>--- cfe/trunk/test/Modules/submodules.cpp (original)<br>+++ cfe/trunk/test/Modules/submodules.cpp Fri Apr 18 17:07:31 2014<br>@@ -32,8 +32,3 @@ extern MyTypeA import_self_test_a; // ex<br> // <a href="mailto:expected-note@import-self-a.h">expected-note@import-self-a.h</a>:1 {{here}}<br> extern MyTypeC import_self_test_c;<br> extern MyTypeD import_self_test_d;<br>-<br>-// expected-error@Inputs/submodules/module.map:15{{header 'missing.h' not found}}<br>-@import missing_headers.missing;<br>-@import missing_headers.not_missing;<br>-void f() { NotMissingFunction(); };<br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br></blockquote></div><br></div></div></blockquote></div><br></body></html>