[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested...
authorSimon Marchi <simon.marchi@ericsson.com>
Thu, 26 Jul 2018 18:55:02 +0000 (18:55 +0000)
committerSimon Marchi <simon.marchi@ericsson.com>
Thu, 26 Jul 2018 18:55:02 +0000 (18:55 +0000)
commit9980c261df44e62b1a374c58a94c55c76e1e50a7
treefcdbcdb865e01f728dd37d045d168cc2308c2042
parentef6c43dc0cb2b05ec9b8500dfb934ac70664d591
[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

Summary:

InMemoryFileSystem::status behaves differently than
RealFileSystem::status.  The Name contained in the Status returned by
RealFileSystem::status will be the path as requested by the caller,
whereas InMemoryFileSystem::status returns the normalized path.

For example, when requested the status for "../src/first.h",
RealFileSystem returns a Status with "../src/first.h" as the Name.
InMemoryFileSystem returns "/absolute/path/to/src/first.h".

The reason for this change is that I want to make a unit test in the
clangd testsuite (where we use an InMemoryFileSystem) to reproduce a
bug I get with the clangd program (where a RealFileSystem is used).
This difference in behavior "hides" the bug in the unit test version.

Reviewers: malaperle, ilya-biryukov, bkramer

Subscribers: cfe-commits, ioeric, ilya-biryukov, bkramer, hokein, omtcyfz

Differential Revision: https://reviews.llvm.org/D48903

llvm-svn: 338057
clang/lib/Basic/FileManager.cpp
clang/lib/Basic/VirtualFileSystem.cpp
clang/unittests/Basic/VirtualFileSystemTest.cpp
clang/unittests/Driver/ToolChainTest.cpp