<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 1 June 2017 at 11:10, Galina Kistanova <span dir="ltr"><<a href="mailto:gkistanova@gmail.com" target="_blank">gkistanova@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello Richard,<br><br>This commit broke tests on few of our builders:<br><br>Failing Tests (2):<br> Clang :: Modules/preprocess-module.cpp<br> Clang :: Modules/preprocess-nested.cpp<br><br><a href="http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/10199" target="_blank">http://lab.llvm.org:8011/build<wbr>ers/llvm-clang-lld-x86_64-<wbr>scei-ps4-windows10pro-fast/bui<wbr>lds/10199</a><br>and<br><a href="http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2819" target="_blank">http://lab.llvm.org:8011/build<wbr>ers/llvm-clang-x86_64-expensiv<wbr>e-checks-win/builds/2819</a><br><br>Please have a look at this?<br></div></blockquote><div> </div><div>Sure, looking.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Also I see that email notifications on these failures were sent.<br></div></blockquote><div><br></div><div>They certainly did not arrive here. As I've mentioned before, I have not received any mail from any <a href="http://lab.llvm.org">lab.llvm.org</a> bots since early March.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks<span class="m_-1225706882951399650HOEnZb"><font color="#888888"><br><br>Galina<br><br></font></span></div><div class="m_-1225706882951399650HOEnZb"><div class="m_-1225706882951399650h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 31, 2017 at 1:56 PM, Richard Smith 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">Author: rsmith<br>
Date: Wed May 31 15:56:55 2017<br>
New Revision: 304346<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=304346&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=304346&view=rev</a><br>
Log:<br>
[modules] When compiling a preprocessed module map, look for headers relative<br>
to the original module map.<br>
<br>
Also use the path and name of the original module map when emitting that<br>
information into the .pcm file. The upshot of this is that the produced .pcm<br>
file will track information for headers in their original locations (where the<br>
module was preprocessed), not relative to whatever directory the preprocessed<br>
module map was in when it was built.<br>
<br>
Modified:<br>
cfe/trunk/include/clang/Basic/<wbr>Module.h<br>
cfe/trunk/include/clang/Lex/He<wbr>aderSearch.h<br>
cfe/trunk/lib/Frontend/Fronten<wbr>dAction.cpp<br>
cfe/trunk/lib/Lex/HeaderSearch<wbr>.cpp<br>
cfe/trunk/lib/Serialization/AS<wbr>TWriter.cpp<br>
cfe/trunk/test/Modules/preproc<wbr>ess-module.cpp<br>
cfe/trunk/test/Modules/preproc<wbr>ess-nested.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Basic/<wbr>Module.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Module.h?rev=304346&r1=304345&r2=304346&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/include/clang/<wbr>Basic/Module.h?rev=304346&r1=3<wbr>04345&r2=304346&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Basic/<wbr>Module.h (original)<br>
+++ cfe/trunk/include/clang/Basic/<wbr>Module.h Wed May 31 15:56:55 2017<br>
@@ -83,6 +83,10 @@ public:<br>
/// are found.<br>
const DirectoryEntry *Directory;<br>
<br>
+ /// \brief The presumed file name for the module map defining this module.<br>
+ /// Only non-empty when building from preprocessed source.<br>
+ std::string PresumedModuleMapFile;<br>
+<br>
/// \brief The umbrella header or directory.<br>
llvm::PointerUnion<const DirectoryEntry *, const FileEntry *> Umbrella;<br>
<br>
<br>
Modified: cfe/trunk/include/clang/Lex/He<wbr>aderSearch.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearch.h?rev=304346&r1=304345&r2=304346&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/include/clang/<wbr>Lex/HeaderSearch.h?rev=304346&<wbr>r1=304345&r2=304346&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Lex/He<wbr>aderSearch.h (original)<br>
+++ cfe/trunk/include/clang/Lex/He<wbr>aderSearch.h Wed May 31 15:56:55 2017<br>
@@ -543,10 +543,13 @@ public:<br>
/// \param Offset [inout] An offset within ID to start parsing. On exit,<br>
/// filled by the end of the parsed contents (either EOF or the<br>
/// location of an end-of-module-map pragma).<br>
- ///<br>
+ /// \param OriginalModuleMapFile The original path to the module map file,<br>
+ /// used to resolve paths within the module (this is required when<br>
+ /// building the module from preprocessed source).<br>
/// \returns true if an error occurred, false otherwise.<br>
bool loadModuleMapFile(const FileEntry *File, bool IsSystem,<br>
- FileID ID = FileID(), unsigned *Offset = nullptr);<br>
+ FileID ID = FileID(), unsigned *Offset = nullptr,<br>
+ StringRef OriginalModuleMapFile = StringRef());<br>
<br>
/// \brief Collect the set of all known, top-level modules.<br>
///<br>
<br>
Modified: cfe/trunk/lib/Frontend/Fronten<wbr>dAction.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=304346&r1=304345&r2=304346&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/Frontend/F<wbr>rontendAction.cpp?rev=304346&r<wbr>1=304345&r2=304346&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Frontend/Fronten<wbr>dAction.cpp (original)<br>
+++ cfe/trunk/lib/Frontend/Fronten<wbr>dAction.cpp Wed May 31 15:56:55 2017<br>
@@ -373,10 +373,11 @@ collectModuleHeaderIncludes(co<wbr>nst LangOp<br>
return std::error_code();<br>
}<br>
<br>
-static bool<br>
-loadModuleMapForModuleBuild(C<wbr>ompilerInstance &CI, StringRef Filename,<br>
- bool IsSystem, bool IsPreprocessed,<br>
- unsigned &Offset) {<br>
+static bool loadModuleMapForModuleBuild(Co<wbr>mpilerInstance &CI,<br>
+ StringRef Filename, bool IsSystem,<br>
+ bool IsPreprocessed,<br>
+ std::string &PresumedModuleMapFile,<br>
+ unsigned &Offset) {<br>
auto &SrcMgr = CI.getSourceManager();<br>
HeaderSearch &HS = CI.getPreprocessor().getHeader<wbr>SearchInfo();<br>
<br>
@@ -388,16 +389,15 @@ loadModuleMapForModuleBuild(Co<wbr>mpilerInst<br>
// line directives are not part of the module map syntax in general.<br>
Offset = 0;<br>
if (IsPreprocessed) {<br>
- std::string PresumedModuleMapFile;<br>
SourceLocation EndOfLineMarker =<br>
ReadOriginalFileName(CI, PresumedModuleMapFile, /*AddLineNote*/true);<br>
if (EndOfLineMarker.isValid())<br>
Offset = CI.getSourceManager().getDecom<wbr>posedLoc(EndOfLineMarker).seco<wbr>nd;<br>
- // FIXME: Use PresumedModuleMapFile as the MODULE_MAP_FILE in the PCM.<br>
}<br>
<br>
// Load the module map file.<br>
- if (HS.loadModuleMapFile(ModuleMa<wbr>p, IsSystem, ModuleMapID, &Offset))<br>
+ if (HS.loadModuleMapFile(ModuleMa<wbr>p, IsSystem, ModuleMapID, &Offset,<br>
+ PresumedModuleMapFile))<br>
return true;<br>
<br>
if (SrcMgr.getBuffer(ModuleMapID)<wbr>->getBufferSize() == Offset)<br>
@@ -664,15 +664,19 @@ bool FrontendAction::BeginSourceFil<wbr>e(Com<br>
if (Input.getKind().getFormat() == InputKind::ModuleMap) {<br>
CI.getLangOpts().setCompiling<wbr>Module(LangOptions::CMK_Module<wbr>Map);<br>
<br>
+ std::string PresumedModuleMapFile;<br>
unsigned OffsetToContents;<br>
if (loadModuleMapForModuleBuild(C<wbr>I, Input.getFile(), Input.isSystem(),<br>
- Input.isPreprocessed(), OffsetToContents))<br>
+ Input.isPreprocessed(),<br>
+ PresumedModuleMapFile, OffsetToContents))<br>
goto failure;<br>
<br>
auto *CurrentModule = prepareToBuildModule(CI, Input.getFile());<br>
if (!CurrentModule)<br>
goto failure;<br>
<br>
+ CurrentModule->PresumedModuleM<wbr>apFile = PresumedModuleMapFile;<br>
+<br>
if (OffsetToContents)<br>
// If the module contents are in the same file, skip to them.<br>
CI.getPreprocessor().setSkipM<wbr>ainFilePreamble(OffsetToConten<wbr>ts, true);<br>
<br>
Modified: cfe/trunk/lib/Lex/HeaderSearch<wbr>.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=304346&r1=304345&r2=304346&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/Lex/Header<wbr>Search.cpp?rev=304346&r1=30434<wbr>5&r2=304346&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Lex/HeaderSearch<wbr>.cpp (original)<br>
+++ cfe/trunk/lib/Lex/HeaderSearch<wbr>.cpp Wed May 31 15:56:55 2017<br>
@@ -1326,14 +1326,27 @@ static const FileEntry *getPrivateModule<br>
}<br>
<br>
bool HeaderSearch::loadModuleMapFil<wbr>e(const FileEntry *File, bool IsSystem,<br>
- FileID ID, unsigned *Offset) {<br>
+ FileID ID, unsigned *Offset,<br>
+ StringRef OriginalModuleMapFile) {<br>
// Find the directory for the module. For frameworks, that may require going<br>
// up from the 'Modules' directory.<br>
const DirectoryEntry *Dir = nullptr;<br>
if (getHeaderSearchOpts().ModuleM<wbr>apFileHomeIsCwd)<br>
Dir = FileMgr.getDirectory(".");<br>
else {<br>
- Dir = File->getDir();<br>
+ if (!OriginalModuleMapFile.empty(<wbr>)) {<br>
+ // We're building a preprocessed module map. Find or invent the directory<br>
+ // that it originally occupied.<br>
+ Dir = FileMgr.getDirectory(<br>
+ llvm::sys::path::parent_path(O<wbr>riginalModuleMapFile));<br>
+ if (!Dir) {<br>
+ auto *FakeFile = FileMgr.getVirtualFile(Origina<wbr>lModuleMapFile, 0, 0);<br>
+ Dir = FakeFile->getDir();<br>
+ }<br>
+ } else {<br>
+ Dir = File->getDir();<br>
+ }<br>
+<br>
StringRef DirName(Dir->getName());<br>
if (llvm::sys::path::filename(Dir<wbr>Name) == "Modules") {<br>
DirName = llvm::sys::path::parent_path(D<wbr>irName);<br>
<br>
Modified: cfe/trunk/lib/Serialization/AS<wbr>TWriter.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=304346&r1=304345&r2=304346&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/Serializat<wbr>ion/ASTWriter.cpp?rev=304346&r<wbr>1=304345&r2=304346&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Serialization/AS<wbr>TWriter.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/AS<wbr>TWriter.cpp Wed May 31 15:56:55 2017<br>
@@ -1422,8 +1422,8 @@ void ASTWriter::WriteControlBlock(P<wbr>repro<br>
Stream.EmitRecordWithBlob(Met<wbr>adataAbbrevCode, Record,<br>
getClangFullRepositoryVersion<wbr>());<br>
}<br>
- if (WritingModule) {<br>
<br>
+ if (WritingModule) {<br>
// Module name<br>
auto Abbrev = std::make_shared<BitCodeAbbrev<wbr>>();<br>
Abbrev->Add(BitCodeAbbrevOp(M<wbr>ODULE_NAME));<br>
@@ -1466,9 +1466,10 @@ void ASTWriter::WriteControlBlock(P<wbr>repro<br>
Record.clear();<br>
<br>
auto &Map = PP.getHeaderSearchInfo().getMo<wbr>duleMap();<br>
-<br>
- // Primary module map file.<br>
- AddPath(Map.getModuleMapFileFo<wbr>rUniquing(WritingModule)->getN<wbr>ame(), Record);<br>
+ AddPath(WritingModule->Presume<wbr>dModuleMapFile.empty()<br>
+ ? Map.getModuleMapFileForUniquin<wbr>g(WritingModule)->getName()<br>
+ : StringRef(WritingModule->Presu<wbr>medModuleMapFile),<br>
+ Record);<br>
<br>
// Additional module map files.<br>
if (auto *AdditionalModMaps =<br>
<br>
Modified: cfe/trunk/test/Modules/preproc<wbr>ess-module.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/preprocess-module.cpp?rev=304346&r1=304345&r2=304346&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/test/Modules/p<wbr>reprocess-module.cpp?rev=30434<wbr>6&r1=304345&r2=304346&view=<wbr>diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/Modules/preproc<wbr>ess-module.cpp (original)<br>
+++ cfe/trunk/test/Modules/preproc<wbr>ess-module.cpp Wed May 31 15:56:55 2017<br>
@@ -14,8 +14,6 @@<br>
// RUN: FileCheck %s --input-file %t/rewrite.ii --check-prefix=CHECK --check-prefix=REWRITE<br>
<br>
// Check that we can build a module from the preprocessed output.<br>
-// FIXME: For now, we need the headers to exist.<br>
-// RUN: touch %t/file.h %t/file2.h<br>
// RUN: %clang_cc1 -fmodules -fmodule-name=file -fmodule-file=%t/fwd.pcm -x c++-module-map-cpp-output %t/no-rewrite.ii -emit-module -o %t/no-rewrite.pcm<br>
// RUN: %clang_cc1 -fmodules -fmodule-name=file -fmodule-file=%t/fwd.pcm -x c++-module-map-cpp-output %t/rewrite.ii -emit-module -o %t/rewrite.pcm<br>
<br>
@@ -27,6 +25,8 @@<br>
// Check the module we built works.<br>
// RUN: %clang_cc1 -fmodules -fmodule-file=%t/no-rewrite.pc<wbr>m %s -I%t -verify -fno-modules-error-recovery<br>
// RUN: %clang_cc1 -fmodules -fmodule-file=%t/rewrite.pcm %s -I%t -verify -fno-modules-error-recovery -DREWRITE<br>
+// RUN: %clang_cc1 -fmodules -fmodule-file=%t/no-rewrite.pc<wbr>m %s -I%t -verify -fno-modules-error-recovery -DINCLUDE -I%S/Inputs/preprocess<br>
+// RUN: %clang_cc1 -fmodules -fmodule-file=%t/rewrite.pcm %s -I%t -verify -fno-modules-error-recovery -DREWRITE -DINCLUDE -I%S/Inputs/preprocess<br>
<br>
<br>
// == module map<br>
@@ -102,7 +102,11 @@ __FILE *a; // expected-error {{declarati<br>
// expected-note@no-rewrite.ii:1 {{here}}<br>
#endif<br>
<br>
+#ifdef INCLUDE<br>
+#include "file.h"<br>
+#else<br>
#pragma clang module import file<br>
+#endif<br>
<br>
FILE *b;<br>
-int x = file2;<br>
+int x = file2; // ok, found in file2.h, even under -DINCLUDE<br>
<br>
Modified: cfe/trunk/test/Modules/preproc<wbr>ess-nested.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/preprocess-nested.cpp?rev=304346&r1=304345&r2=304346&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/test/Modules/p<wbr>reprocess-nested.cpp?rev=30434<wbr>6&r1=304345&r2=304346&view=<wbr>diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/Modules/preproc<wbr>ess-nested.cpp (original)<br>
+++ cfe/trunk/test/Modules/preproc<wbr>ess-nested.cpp Wed May 31 15:56:55 2017<br>
@@ -8,8 +8,6 @@<br>
// RUN: FileCheck %s --input-file %t/rewrite.ii --check-prefix=CHECK --check-prefix=REWRITE<br>
<br>
// Check that we can build a module from the preprocessed output.<br>
-// FIXME: For now, the files need to exist.<br>
-// RUN: touch %t/a.h %t/b.h %t/c.h<br>
// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visi<wbr>bility -fmodule-name=nested -x c++-module-map-cpp-output %t/no-rewrite.ii -emit-module -o %t/no-rewrite.pcm<br>
// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visi<wbr>bility -fmodule-name=nested -x c++-module-map-cpp-output %t/rewrite.ii -emit-module -o %t/rewrite.pcm<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>