vsapsai added a comment.

In https://reviews.llvm.org/D49518#1168038, @bruno wrote:

> Hi Volodymyr, thanks for improving this.
>
> > Need to double check what tests we have when using relative path names at 
> > the root level.
>
> Another interesting place to look at is 
> `unittests/Basic/VirtualFileSystemTest.cpp`


Thanks for the pointer. Probably I'll move the added test there as it doesn't 
need full file system interaction and doesn't need to execute entire clang_cc1.

>> I'd like to make the behavior consistent because a file name is a specific 
>> case of relative paths. So far there are no assertions and no errors but 
>> file lookup doesn't seem to be working.
> 
> Makes sense. My general impression is that relative paths don't make sense 
> here either, but you can address that in a follow up patch (giving time for 
> any potential counterexample on this).

Based on the code, relative paths won't work for file lookup. That is so 
because in `RedirectingFileSystem::lookupPath` we convert paths to absolute

  if (std::error_code EC = makeAbsolute(Path))
    return EC;
  // ...
  sys::path::const_iterator Start = sys::path::begin(Path);
  sys::path::const_iterator End = sys::path::end(Path);

and textually compare them with VFS entry name 
<https://github.com/llvm-mirror/clang/blob/f70ff96a80f2680e5aafa2becd194e2796cf2db9/lib/Basic/VirtualFileSystem.cpp#L1612-L1617>.

Having an error for relative paths makes the change cleaner, so I'll include it 
in this patch.


https://reviews.llvm.org/D49518



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to