[VirtualFileSystem] Support virtual working directory in the RedirectingFS
authorJonas Devlieghere <jonas@devlieghere.com>
Tue, 15 Oct 2019 17:14:24 +0000 (17:14 +0000)
committerJonas Devlieghere <jonas@devlieghere.com>
Tue, 15 Oct 2019 17:14:24 +0000 (17:14 +0000)
commit0b9981b180ef2f08d2a97cfda2fb6ca35ad5e93c
tree43455e702c7c2c9721b611272cfc2a5d092c0149
parentd3bd5b3d71ae9fc3a3a45e05d5dba6b1ecbcb2f5
[VirtualFileSystem] Support virtual working directory in the  RedirectingFS

Before this patch, changing the working directory of the RedirectingFS
would just forward to its external file system. This prevented us from
having a working directory that only existed in the VFS mapping.

This patch adds support for a virtual working directory in the
RedirectingFileSystem. It now keeps track of its own WD in addition to
updating the WD of the external file system. This ensures that we can
still fall through for relative paths.

This change was originally motivated by the reproducer infrastructure in
LLDB where we want to deal transparently with relative paths.

Differential revision: https://reviews.llvm.org/D65677

llvm-svn: 374917
llvm/include/llvm/Support/VirtualFileSystem.h
llvm/lib/Support/VirtualFileSystem.cpp
llvm/unittests/Support/VirtualFileSystemTest.cpp