<div dir="ltr">The bot is still red: <a href="http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast">http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast</a></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 22, 2016 at 6:48 PM, Bruno Cardoso Lopes <span dir="ltr"><<a href="mailto:bruno.cardoso@gmail.com" target="_blank">bruno.cardoso@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Sean,<br>
<br>
This is hopefully fixed in r261556.<br>
<div class="HOEnZb"><div class="h5"><br>
On Mon, Feb 22, 2016 at 5:45 PM, Sean Silva <<a href="mailto:chisophugis@gmail.com">chisophugis@gmail.com</a>> wrote:<br>
> This or r261551 seem to be causing a build failure:<br>
> <a href="http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/527" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/527</a><br>
><br>
> -- Sean SIlva<br>
><br>
> On Mon, Feb 22, 2016 at 10:41 AM, Bruno Cardoso Lopes via cfe-commits<br>
> <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br>
>><br>
>> Author: bruno<br>
>> Date: Mon Feb 22 12:41:09 2016<br>
>> New Revision: 261552<br>
>><br>
>> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=261552&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=261552&view=rev</a><br>
>> Log:<br>
>> [VFS] Add 'overlay-relative' field to YAML files<br>
>><br>
>> The VFS overlay mapping between virtual paths and real paths is done<br>
>> through<br>
>> the 'external-contents' entries in YAML files, which contains hardcoded<br>
>> paths<br>
>> to the real files.<br>
>><br>
>> When a module compilation crashes, headers are dumped into<br>
>> <name>.cache/vfs<br>
>> directory and are mapped via the <name>.cache/vfs/vfs.yaml. The script<br>
>> generated for reproduction uses -ivfsoverlay pointing to file to gather<br>
>> the<br>
>> mapping between virtual paths and files inside <name>.cache/vfs.<br>
>> Currently, we<br>
>> are only capable of reproducing such crashes in the same machine as they<br>
>> happen, because of the hardcoded paths in 'external-contents'.<br>
>><br>
>> To be able to reproduce a crash in another machine, this patch introduces<br>
>> a new<br>
>> option in the VFS yaml file called 'overlay-relative'. When it's equal to<br>
>> 'true' it means that the provided path to the YAML file through the<br>
>> -ivfsoverlay option should also be used to prefix the final path for every<br>
>> 'external-contents'.<br>
>><br>
>> Example, given the invocation snippet "... -ivfsoverlay<br>
>> <name>.cache/vfs/vfs.yaml" and the following entry in the yaml file:<br>
>><br>
>> "overlay-relative": "true",<br>
>> "roots": [<br>
>> ...<br>
>>   "type": "directory",<br>
>>   "name": "/usr/include",<br>
>>   "contents": [<br>
>>     {<br>
>>       "type": "file",<br>
>>       "name": "stdio.h",<br>
>>       "external-contents": "/usr/include/stdio.h"<br>
>>     },<br>
>> ...<br>
>><br>
>> Here, a file manager request for virtual "/usr/include/stdio.h", that will<br>
>> map<br>
>> into real path "/<absolute_path_to>/<name>.cache/vfs/usr/include/stdio.h.<br>
>><br>
>> This is a useful feature for debugging module crashes in machines other<br>
>> than<br>
>> the one where the error happened.<br>
>><br>
>> Differential Revision: <a href="http://reviews.llvm.org/D17457" rel="noreferrer" target="_blank">http://reviews.llvm.org/D17457</a><br>
>><br>
>> rdar://problem/24499339<br>
>><br>
>> Added:<br>
>>     cfe/trunk/test/Modules/crash-vfs-relative-overlay.m<br>
>>       - copied, changed from r261551,<br>
>> cfe/trunk/test/Modules/crash-vfs-path-traversal.m<br>
>> Modified:<br>
>>     cfe/trunk/include/clang/Basic/VirtualFileSystem.h<br>
>>     cfe/trunk/lib/Basic/VirtualFileSystem.cpp<br>
>>     cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br>
>>     cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp<br>
>>     cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m<br>
>>     cfe/trunk/test/Modules/crash-vfs-path-traversal.m<br>
>><br>
>> Modified: cfe/trunk/include/clang/Basic/VirtualFileSystem.h<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VirtualFileSystem.h?rev=261552&r1=261551&r2=261552&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VirtualFileSystem.h?rev=261552&r1=261551&r2=261552&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- cfe/trunk/include/clang/Basic/VirtualFileSystem.h (original)<br>
>> +++ cfe/trunk/include/clang/Basic/VirtualFileSystem.h Mon Feb 22 12:41:09<br>
>> 2016<br>
>> @@ -310,6 +310,7 @@ llvm::sys::fs::UniqueID getNextVirtualUn<br>
>>  IntrusiveRefCntPtr<FileSystem><br>
>>  getVFSFromYAML(std::unique_ptr<llvm::MemoryBuffer> Buffer,<br>
>>                 llvm::SourceMgr::DiagHandlerTy DiagHandler,<br>
>> +               StringRef YAMLFilePath,<br>
>>                 void *DiagContext = nullptr,<br>
>>                 IntrusiveRefCntPtr<FileSystem> ExternalFS =<br>
>> getRealFileSystem());<br>
>><br>
>> @@ -323,6 +324,8 @@ struct YAMLVFSEntry {<br>
>>  class YAMLVFSWriter {<br>
>>    std::vector<YAMLVFSEntry> Mappings;<br>
>>    Optional<bool> IsCaseSensitive;<br>
>> +  Optional<bool> IsOverlayRelative;<br>
>> +  std::string OverlayDir;<br>
>><br>
>>  public:<br>
>>    YAMLVFSWriter() {}<br>
>> @@ -330,6 +333,11 @@ public:<br>
>>    void setCaseSensitivity(bool CaseSensitive) {<br>
>>      IsCaseSensitive = CaseSensitive;<br>
>>    }<br>
>> +  void setOverlayDir(StringRef OverlayDirectory) {<br>
>> +    IsOverlayRelative = true;<br>
>> +    OverlayDir.assign(OverlayDirectory.str());<br>
>> +  }<br>
>> +<br>
>>    void write(llvm::raw_ostream &OS);<br>
>>  };<br>
>><br>
>><br>
>> Modified: cfe/trunk/lib/Basic/VirtualFileSystem.cpp<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=261552&r1=261551&r2=261552&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/VirtualFileSystem.cpp?rev=261552&r1=261551&r2=261552&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- cfe/trunk/lib/Basic/VirtualFileSystem.cpp (original)<br>
>> +++ cfe/trunk/lib/Basic/VirtualFileSystem.cpp Mon Feb 22 12:41:09 2016<br>
>> @@ -790,6 +790,7 @@ public:<br>
>>  /// All configuration options are optional.<br>
>>  ///   'case-sensitive': <boolean, default=true><br>
>>  ///   'use-external-names': <boolean, default=true><br>
>> +///   'overlay-relative': <boolean, default=false><br>
>>  ///<br>
>>  /// Virtual directories are represented as<br>
>>  /// \verbatim<br>
>> @@ -832,6 +833,10 @@ class RedirectingFileSystem : public vfs<br>
>>    std::vector<std::unique_ptr<Entry>> Roots;<br>
>>    /// \brief The file system to use for external references.<br>
>>    IntrusiveRefCntPtr<FileSystem> ExternalFS;<br>
>> +  /// If IsRelativeOverlay is set, this represents the directory<br>
>> +  /// path that should be prefixed to each 'external-contents' entry<br>
>> +  /// when reading from YAML files.<br>
>> +  std::string ExternalContentsPrefixDir;<br>
>><br>
>>    /// @name Configuration<br>
>>    /// @{<br>
>> @@ -841,6 +846,10 @@ class RedirectingFileSystem : public vfs<br>
>>    /// Currently, case-insensitive matching only works correctly with<br>
>> ASCII.<br>
>>    bool CaseSensitive;<br>
>><br>
>> +  /// IsRelativeOverlay marks whether a IsExternalContentsPrefixDir path<br>
>> must<br>
>> +  /// be prefixed in every 'external-contents' when reading from YAML<br>
>> files.<br>
>> +  bool IsRelativeOverlay = false;<br>
>> +<br>
>>    /// \brief Whether to use to use the value of 'external-contents' for<br>
>> the<br>
>>    /// names of files.  This global value is overridable on a per-file<br>
>> basis.<br>
>>    bool UseExternalNames;<br>
>> @@ -868,8 +877,8 @@ public:<br>
>>    /// returns a virtual file system representing its contents.<br>
>>    static RedirectingFileSystem *<br>
>>    create(std::unique_ptr<MemoryBuffer> Buffer,<br>
>> -         SourceMgr::DiagHandlerTy DiagHandler, void *DiagContext,<br>
>> -         IntrusiveRefCntPtr<FileSystem> ExternalFS);<br>
>> +         SourceMgr::DiagHandlerTy DiagHandler, StringRef YAMLFilePath,<br>
>> +         void *DiagContext, IntrusiveRefCntPtr<FileSystem> ExternalFS);<br>
>><br>
>>    ErrorOr<Status> status(const Twine &Path) override;<br>
>>    ErrorOr<std::unique_ptr<File>> openFileForRead(const Twine &Path)<br>
>> override;<br>
>> @@ -902,6 +911,15 @@ public:<br>
>>      return<br>
>> directory_iterator(std::make_shared<VFSFromYamlDirIterImpl>(Dir,<br>
>>          *this, D->contents_begin(), D->contents_end(), EC));<br>
>>    }<br>
>> +<br>
>> +  void setExternalContentsPrefixDir(StringRef PrefixDir) {<br>
>> +    ExternalContentsPrefixDir = PrefixDir.str();<br>
>> +  }<br>
>> +<br>
>> +  StringRef getExternalContentsPrefixDir() const {<br>
>> +    return ExternalContentsPrefixDir;<br>
>> +  }<br>
>> +<br>
>>  };<br>
>><br>
>>  /// \brief A helper class to hold the common YAML parsing state.<br>
>> @@ -981,7 +999,7 @@ class RedirectingFileSystemParser {<br>
>>      return true;<br>
>>    }<br>
>><br>
>> -  std::unique_ptr<Entry> parseEntry(yaml::Node *N) {<br>
>> +  std::unique_ptr<Entry> parseEntry(yaml::Node *N, RedirectingFileSystem<br>
>> *FS) {<br>
>>      yaml::MappingNode *M = dyn_cast<yaml::MappingNode>(N);<br>
>>      if (!M) {<br>
>>        error(N, "expected mapping node for file or directory entry");<br>
>> @@ -1057,7 +1075,7 @@ class RedirectingFileSystemParser {<br>
>>          for (yaml::SequenceNode::iterator I = Contents->begin(),<br>
>>                                            E = Contents->end();<br>
>>               I != E; ++I) {<br>
>> -          if (std::unique_ptr<Entry> E = parseEntry(&*I))<br>
>> +          if (std::unique_ptr<Entry> E = parseEntry(&*I, FS))<br>
>>              EntryArrayContents.push_back(std::move(E));<br>
>>            else<br>
>>              return nullptr;<br>
>> @@ -1071,12 +1089,22 @@ class RedirectingFileSystemParser {<br>
>>          HasContents = true;<br>
>>          if (!parseScalarString(I->getValue(), Value, Buffer))<br>
>>            return nullptr;<br>
>> -        SmallString<256> Path(Value);<br>
>> +<br>
>> +        SmallString<128> FullPath;<br>
>> +        if (FS->IsRelativeOverlay) {<br>
>> +          FullPath = FS->getExternalContentsPrefixDir();<br>
>> +          assert(!FullPath.empty() &&<br>
>> +                 "External contents prefix directory must exist");<br>
>> +          llvm::sys::path::append(FullPath, Value);<br>
>> +        } else {<br>
>> +          FullPath = Value;<br>
>> +        }<br>
>> +<br>
>>          // Guarantee that old YAML files containing paths with ".." and<br>
>> "." are<br>
>>          // properly canonicalized before read into the VFS.<br>
>> -        Path = sys::path::remove_leading_dotslash(Path);<br>
>> -        sys::path::remove_dots(Path, /*remove_dot_dot=*/true);<br>
>> -        ExternalContentsPath = Path.str();<br>
>> +        FullPath = sys::path::remove_leading_dotslash(FullPath);<br>
>> +        sys::path::remove_dots(FullPath, /*remove_dot_dot=*/true);<br>
>> +        ExternalContentsPath = FullPath.str();<br>
>>        } else if (Key == "use-external-name") {<br>
>>          bool Val;<br>
>>          if (!parseScalarBool(I->getValue(), Val))<br>
>> @@ -1162,6 +1190,7 @@ public:<br>
>>        KeyStatusPair("version", true),<br>
>>        KeyStatusPair("case-sensitive", false),<br>
>>        KeyStatusPair("use-external-names", false),<br>
>> +      KeyStatusPair("overlay-relative", false),<br>
>>        KeyStatusPair("roots", true),<br>
>>      };<br>
>><br>
>> @@ -1187,7 +1216,7 @@ public:<br>
>><br>
>>          for (yaml::SequenceNode::iterator I = Roots->begin(), E =<br>
>> Roots->end();<br>
>>               I != E; ++I) {<br>
>> -          if (std::unique_ptr<Entry> E = parseEntry(&*I))<br>
>> +          if (std::unique_ptr<Entry> E = parseEntry(&*I, FS))<br>
>>              FS->Roots.push_back(std::move(E));<br>
>>            else<br>
>>              return false;<br>
>> @@ -1213,6 +1242,9 @@ public:<br>
>>        } else if (Key == "case-sensitive") {<br>
>>          if (!parseScalarBool(I->getValue(), FS->CaseSensitive))<br>
>>            return false;<br>
>> +      } else if (Key == "overlay-relative") {<br>
>> +        if (!parseScalarBool(I->getValue(), FS->IsRelativeOverlay))<br>
>> +          return false;<br>
>>        } else if (Key == "use-external-names") {<br>
>>          if (!parseScalarBool(I->getValue(), FS->UseExternalNames))<br>
>>            return false;<br>
>> @@ -1233,9 +1265,11 @@ public:<br>
>><br>
>>  Entry::~Entry() = default;<br>
>><br>
>> -RedirectingFileSystem *RedirectingFileSystem::create(<br>
>> -    std::unique_ptr<MemoryBuffer> Buffer, SourceMgr::DiagHandlerTy<br>
>> DiagHandler,<br>
>> -    void *DiagContext, IntrusiveRefCntPtr<FileSystem> ExternalFS) {<br>
>> +RedirectingFileSystem *<br>
>> +RedirectingFileSystem::create(std::unique_ptr<MemoryBuffer> Buffer,<br>
>> +                              SourceMgr::DiagHandlerTy DiagHandler,<br>
>> +                              StringRef YAMLFilePath, void *DiagContext,<br>
>> +                              IntrusiveRefCntPtr<FileSystem> ExternalFS)<br>
>> {<br>
>><br>
>>    SourceMgr SM;<br>
>>    yaml::Stream Stream(Buffer->getMemBufferRef(), SM);<br>
>> @@ -1252,6 +1286,23 @@ RedirectingFileSystem *RedirectingFileSy<br>
>><br>
>>    std::unique_ptr<RedirectingFileSystem> FS(<br>
>>        new RedirectingFileSystem(ExternalFS));<br>
>> +<br>
>> +  if (!YAMLFilePath.empty()) {<br>
>> +    // Use the YAML path from -ivfsoverlay to compute the dir to be<br>
>> prefixed<br>
>> +    // to each 'external-contents' path.<br>
>> +    //<br>
>> +    // Example:<br>
>> +    //    -ivfsoverlay dummy.cache/vfs/vfs.yaml<br>
>> +    // yields:<br>
>> +    //  FS->ExternalContentsPrefixDir =><br>
>> /<absolute_path_to>/dummy.cache/vfs<br>
>> +    //<br>
>> +    SmallString<256> OverlayAbsDir =<br>
>> sys::path::parent_path(YAMLFilePath);<br>
>> +    std::error_code EC = llvm::sys::fs::make_absolute(OverlayAbsDir);<br>
>> +    assert(!EC && "Overlay dir final path must be absolute");<br>
>> +    (void)EC;<br>
>> +    FS->setExternalContentsPrefixDir(OverlayAbsDir);<br>
>> +  }<br>
>> +<br>
>>    if (!P.parse(Root, FS.get()))<br>
>>      return nullptr;<br>
>><br>
>> @@ -1396,10 +1447,12 @@ RedirectingFileSystem::openFileForRead(c<br>
>><br>
>>  IntrusiveRefCntPtr<FileSystem><br>
>>  vfs::getVFSFromYAML(std::unique_ptr<MemoryBuffer> Buffer,<br>
>> -                    SourceMgr::DiagHandlerTy DiagHandler, void<br>
>> *DiagContext,<br>
>> +                    SourceMgr::DiagHandlerTy DiagHandler,<br>
>> +                    StringRef YAMLFilePath,<br>
>> +                    void *DiagContext,<br>
>>                      IntrusiveRefCntPtr<FileSystem> ExternalFS) {<br>
>>    return RedirectingFileSystem::create(std::move(Buffer), DiagHandler,<br>
>> -                                       DiagContext, ExternalFS);<br>
>> +                                       YAMLFilePath, DiagContext,<br>
>> ExternalFS);<br>
>>  }<br>
>><br>
>>  UniqueID vfs::getNextVirtualUniqueID() {<br>
>> @@ -1431,7 +1484,8 @@ class JSONWriter {<br>
>><br>
>>  public:<br>
>>    JSONWriter(llvm::raw_ostream &OS) : OS(OS) {}<br>
>> -  void write(ArrayRef<YAMLVFSEntry> Entries, Optional<bool><br>
>> IsCaseSensitive);<br>
>> +  void write(ArrayRef<YAMLVFSEntry> Entries, Optional<bool><br>
>> IsCaseSensitive,<br>
>> +             Optional<bool> IsOverlayRelative, StringRef OverlayDir);<br>
>>  };<br>
>>  }<br>
>><br>
>> @@ -1484,7 +1538,9 @@ void JSONWriter::writeEntry(StringRef VP<br>
>>  }<br>
>><br>
>>  void JSONWriter::write(ArrayRef<YAMLVFSEntry> Entries,<br>
>> -                       Optional<bool> IsCaseSensitive) {<br>
>> +                       Optional<bool> IsCaseSensitive,<br>
>> +                       Optional<bool> IsOverlayRelative,<br>
>> +                       StringRef OverlayDir) {<br>
>>    using namespace llvm::sys;<br>
>><br>
>>    OS << "{\n"<br>
>> @@ -1492,12 +1548,27 @@ void JSONWriter::write(ArrayRef<YAMLVFSE<br>
>>    if (IsCaseSensitive.hasValue())<br>
>>      OS << "  'case-sensitive': '"<br>
>>         << (IsCaseSensitive.getValue() ? "true" : "false") << "',\n";<br>
>> +  bool UseOverlayRelative = false;<br>
>> +  if (IsOverlayRelative.hasValue()) {<br>
>> +    UseOverlayRelative = IsOverlayRelative.getValue();<br>
>> +    OS << "  'overlay-relative': '"<br>
>> +       << (UseOverlayRelative ? "true" : "false") << "',\n";<br>
>> +  }<br>
>>    OS << "  'roots': [\n";<br>
>><br>
>>    if (!Entries.empty()) {<br>
>>      const YAMLVFSEntry &Entry = Entries.front();<br>
>>      startDirectory(path::parent_path(Entry.VPath));<br>
>> -    writeEntry(path::filename(Entry.VPath), Entry.RPath);<br>
>> +<br>
>> +    StringRef RPath = Entry.RPath;<br>
>> +    if (UseOverlayRelative) {<br>
>> +      unsigned OverlayDirLen = OverlayDir.size();<br>
>> +      assert(RPath.substr(0, OverlayDirLen) == OverlayDir &&<br>
>> +             "Overlay dir must be contained in RPath");<br>
>> +      RPath = RPath.slice(OverlayDirLen, RPath.size());<br>
>> +    }<br>
>> +<br>
>> +    writeEntry(path::filename(Entry.VPath), RPath);<br>
>><br>
>>      for (const auto &Entry : Entries.slice(1)) {<br>
>>        StringRef Dir = path::parent_path(Entry.VPath);<br>
>> @@ -1511,7 +1582,14 @@ void JSONWriter::write(ArrayRef<YAMLVFSE<br>
>>          OS << ",\n";<br>
>>          startDirectory(Dir);<br>
>>        }<br>
>> -      writeEntry(path::filename(Entry.VPath), Entry.RPath);<br>
>> +      StringRef RPath = Entry.RPath;<br>
>> +      if (UseOverlayRelative) {<br>
>> +        unsigned OverlayDirLen = OverlayDir.size();<br>
>> +        assert(RPath.substr(0, OverlayDirLen) == OverlayDir &&<br>
>> +               "Overlay dir must be contained in RPath");<br>
>> +        RPath = RPath.slice(OverlayDirLen, RPath.size());<br>
>> +      }<br>
>> +      writeEntry(path::filename(Entry.VPath), RPath);<br>
>>      }<br>
>><br>
>>      while (!DirStack.empty()) {<br>
>> @@ -1531,7 +1609,8 @@ void YAMLVFSWriter::write(llvm::raw_ostr<br>
>>      return LHS.VPath < RHS.VPath;<br>
>>    });<br>
>><br>
>> -  JSONWriter(OS).write(Mappings, IsCaseSensitive);<br>
>> +  JSONWriter(OS).write(Mappings, IsCaseSensitive, IsOverlayRelative,<br>
>> +                       OverlayDir);<br>
>>  }<br>
>><br>
>>  VFSFromYamlDirIterImpl::VFSFromYamlDirIterImpl(<br>
>><br>
>> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=261552&r1=261551&r2=261552&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=261552&r1=261551&r2=261552&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)<br>
>> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Feb 22 12:41:09 2016<br>
>> @@ -2344,8 +2344,8 @@ createVFSFromCompilerInvocation(const Co<br>
>>        return IntrusiveRefCntPtr<vfs::FileSystem>();<br>
>>      }<br>
>><br>
>> -    IntrusiveRefCntPtr<vfs::FileSystem> FS =<br>
>> -        vfs::getVFSFromYAML(std::move(Buffer.get()), /*DiagHandler*/<br>
>> nullptr);<br>
>> +    IntrusiveRefCntPtr<vfs::FileSystem> FS = vfs::getVFSFromYAML(<br>
>> +        std::move(Buffer.get()), /*DiagHandler*/ nullptr, File);<br>
>>      if (!FS.get()) {<br>
>>        Diags.Report(diag::err_invalid_vfs_overlay) << File;<br>
>>        return IntrusiveRefCntPtr<vfs::FileSystem>();<br>
>><br>
>> Modified: cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp?rev=261552&r1=261551&r2=261552&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp?rev=261552&r1=261551&r2=261552&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp (original)<br>
>> +++ cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp Mon Feb 22<br>
>> 12:41:09 2016<br>
>> @@ -51,6 +51,10 @@ void ModuleDependencyCollector::writeFil<br>
>>    SmallString<256> Dest = getDest();<br>
>>    llvm::sys::path::append(Dest, "vfs.yaml");<br>
>><br>
>> +  // Default to use relative overlay directories in the VFS yaml file.<br>
>> This<br>
>> +  // allows crash reproducer scripts to work across machines.<br>
>> +  VFSWriter.setOverlayDir(getDest());<br>
>> +<br>
>>    std::error_code EC;<br>
>>    llvm::raw_fd_ostream OS(Dest, EC, llvm::sys::fs::F_Text);<br>
>>    if (EC) {<br>
>><br>
>> Modified: cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m?rev=261552&r1=261551&r2=261552&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m?rev=261552&r1=261551&r2=261552&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m (original)<br>
>> +++ cfe/trunk/test/Modules/crash-vfs-path-symlink-component.m Mon Feb 22<br>
>> 12:41:09 2016<br>
>> @@ -40,21 +40,21 @@<br>
>>  // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"<br>
>><br>
>>  // CHECKYAML: 'type': 'directory'<br>
>> -// CHECKYAML: 'name': "{{[^ ]*}}/i/usr/include",<br>
>> +// CHECKYAML: 'name': "/[[PATH:.*]]/i/usr/include",<br>
>>  // CHECKYAML-NEXT: 'contents': [<br>
>>  // CHECKYAML-NEXT:   {<br>
>>  // CHECKYAML-NEXT:     'type': 'file',<br>
>>  // CHECKYAML-NEXT:     'name': "module.map",<br>
>> -// CHECKYAML-NEXT:     'external-contents': "{{[^ ]*}}.cache/vfs/{{[^<br>
>> ]*}}/i/usr/include/module.map"<br>
>> +// CHECKYAML-NEXT:     'external-contents':<br>
>> "/[[PATH]]/i/usr/include/module.map"<br>
>>  // CHECKYAML-NEXT:   },<br>
>><br>
>>  // CHECKYAML: 'type': 'directory'<br>
>> -// CHECKYAML: 'name': "{{[^ ]*}}/i/usr",<br>
>> +// CHECKYAML: 'name': "/[[PATH]]/i/usr",<br>
>>  // CHECKYAML-NEXT: 'contents': [<br>
>>  // CHECKYAML-NEXT:   {<br>
>>  // CHECKYAML-NEXT:     'type': 'file',<br>
>>  // CHECKYAML-NEXT:     'name': "module.map",<br>
>> -// CHECKYAML-NEXT:     'external-contents': "{{[^ ]*}}.cache/vfs/{{[^<br>
>> ]*}}/i/usr/include/module.map"<br>
>> +// CHECKYAML-NEXT:     'external-contents':<br>
>> "/[[PATH]]/i/usr/include/module.map"<br>
>>  // CHECKYAML-NEXT:   },<br>
>><br>
>>  // Test that by using the previous generated YAML file clang is able to<br>
>> find the<br>
>><br>
>> Modified: cfe/trunk/test/Modules/crash-vfs-path-traversal.m<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-path-traversal.m?rev=261552&r1=261551&r2=261552&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-path-traversal.m?rev=261552&r1=261551&r2=261552&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- cfe/trunk/test/Modules/crash-vfs-path-traversal.m (original)<br>
>> +++ cfe/trunk/test/Modules/crash-vfs-path-traversal.m Mon Feb 22 12:41:09<br>
>> 2016<br>
>> @@ -35,12 +35,12 @@<br>
>>  // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"<br>
>><br>
>>  // CHECKYAML: 'type': 'directory'<br>
>> -// CHECKYAML: 'name': "{{[^ ]*}}/Inputs/System/usr/include",<br>
>> +// CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/System/usr/include",<br>
>>  // CHECKYAML-NEXT: 'contents': [<br>
>>  // CHECKYAML-NEXT:   {<br>
>>  // CHECKYAML-NEXT:     'type': 'file',<br>
>>  // CHECKYAML-NEXT:     'name': "module.map",<br>
>> -// CHECKYAML-NEXT:     'external-contents': "{{[^<br>
>> ]*}}/Inputs/System/usr/include/module.map"<br>
>> +// CHECKYAML-NEXT:     'external-contents':<br>
>> "/[[PATH]]/Inputs/System/usr/include/module.map"<br>
>>  // CHECKYAML-NEXT:   },<br>
>><br>
>>  // Replace the paths in the YAML files with relative ".." traversals<br>
>> @@ -49,9 +49,10 @@<br>
>><br>
>>  // RUN: sed -e "s@usr/include@usr/include/../include@g" \<br>
>>  // RUN:     %t/crash-vfs-*.cache/vfs/vfs.yaml > %t/vfs.yaml<br>
>> +// RUN: cp %t/vfs.yaml %t/crash-vfs-*.cache/vfs/vfs.yaml<br>
>>  // RUN: unset FORCE_CLANG_DIAGNOSTICS_CRASH<br>
>>  // RUN: %clang -E %s -I %S/Inputs/System -isysroot %/t/i/ \<br>
>> -// RUN:     -ivfsoverlay %t/vfs.yaml -fmodules \<br>
>> +// RUN:     -ivfsoverlay %t/crash-vfs-*.cache/vfs/vfs.yaml -fmodules \<br>
>>  // RUN:     -fmodules-cache-path=%t/m/ 2>&1 \<br>
>>  // RUN:     | FileCheck %s --check-prefix=CHECKOVERLAY<br>
>><br>
>><br>
>> Copied: cfe/trunk/test/Modules/crash-vfs-relative-overlay.m (from r261551,<br>
>> cfe/trunk/test/Modules/crash-vfs-path-traversal.m)<br>
>> URL:<br>
>> <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-relative-overlay.m?p2=cfe/trunk/test/Modules/crash-vfs-relative-overlay.m&p1=cfe/trunk/test/Modules/crash-vfs-path-traversal.m&r1=261551&r2=261552&rev=261552&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/crash-vfs-relative-overlay.m?p2=cfe/trunk/test/Modules/crash-vfs-relative-overlay.m&p1=cfe/trunk/test/Modules/crash-vfs-path-traversal.m&r1=261551&r2=261552&rev=261552&view=diff</a><br>
>><br>
>> ==============================================================================<br>
>> --- cfe/trunk/test/Modules/crash-vfs-path-traversal.m (original)<br>
>> +++ cfe/trunk/test/Modules/crash-vfs-relative-overlay.m Mon Feb 22<br>
>> 12:41:09 2016<br>
>> @@ -17,7 +17,7 @@<br>
>>  // RUN: find %t/crash-vfs-*.cache/vfs | \<br>
>>  // RUN:   grep "Inputs/System/usr/include/stdio.h" | count 1<br>
>><br>
>> -#include "usr/././//////include/../include/./././../include/stdio.h"<br>
>> +#include "usr/include/stdio.h"<br>
>><br>
>>  // CHECK: Preprocessed source(s) and associated run script(s) are located<br>
>> at:<br>
>>  // CHECK-NEXT: note: diagnostic msg: {{.*}}.m<br>
>> @@ -35,23 +35,21 @@<br>
>>  // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"<br>
>><br>
>>  // CHECKYAML: 'type': 'directory'<br>
>> -// CHECKYAML: 'name': "{{[^ ]*}}/Inputs/System/usr/include",<br>
>> +// CHECKYAML: 'name': "/[[PATH:.*]]/Inputs/System/usr/include",<br>
>>  // CHECKYAML-NEXT: 'contents': [<br>
>>  // CHECKYAML-NEXT:   {<br>
>>  // CHECKYAML-NEXT:     'type': 'file',<br>
>>  // CHECKYAML-NEXT:     'name': "module.map",<br>
>> -// CHECKYAML-NEXT:     'external-contents': "{{[^<br>
>> ]*}}/Inputs/System/usr/include/module.map"<br>
>> +// CHECKYAML-NOT:      'external-contents': "{{[^ ]*}}.cache<br>
>> +// CHECKYAML-NEXT:     'external-contents':<br>
>> "/[[PATH]]/Inputs/System/usr/include/module.map"<br>
>>  // CHECKYAML-NEXT:   },<br>
>><br>
>> -// Replace the paths in the YAML files with relative ".." traversals<br>
>> -// and fed into clang to test whether we're correctly representing them<br>
>> -// in the VFS overlay.<br>
>> +// Test that reading the YAML file will yield the correct path after<br>
>> +// the overlay dir is prefixed to access headers in .cache/vfs directory.<br>
>><br>
>> -// RUN: sed -e "s@usr/include@usr/include/../include@g" \<br>
>> -// RUN:     %t/crash-vfs-*.cache/vfs/vfs.yaml > %t/vfs.yaml<br>
>>  // RUN: unset FORCE_CLANG_DIAGNOSTICS_CRASH<br>
>>  // RUN: %clang -E %s -I %S/Inputs/System -isysroot %/t/i/ \<br>
>> -// RUN:     -ivfsoverlay %t/vfs.yaml -fmodules \<br>
>> +// RUN:     -ivfsoverlay %t/crash-vfs-*.cache/vfs/vfs.yaml -fmodules \<br>
>>  // RUN:     -fmodules-cache-path=%t/m/ 2>&1 \<br>
>>  // RUN:     | FileCheck %s --check-prefix=CHECKOVERLAY<br>
>><br>
>><br>
>><br>
>> _______________________________________________<br>
>> cfe-commits mailing list<br>
>> <a href="mailto:cfe-commits@lists.llvm.org">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/mailman/listinfo/cfe-commits</a><br>
><br>
><br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Bruno Cardoso Lopes<br>
<a href="http://www.brunocardoso.cc" rel="noreferrer" target="_blank">http://www.brunocardoso.cc</a><br>
</font></span></blockquote></div><br></div>