diff options
author | Ilya Biryukov <ibiryukov@google.com> | 2017-08-02 07:25:24 +0000 |
---|---|---|
committer | Ilya Biryukov <ibiryukov@google.com> | 2017-08-02 07:25:24 +0000 |
commit | 47035c0255f8544e35a208ab01fa0dbdbf7812ef (patch) | |
tree | 23e18b36c9d93c61a15b3c465fad9ad0ff81e694 /clang/unittests/Basic/FileManagerTest.cpp | |
parent | 7b370e46e71e3a0154a3ad339e659f9ccc40d3f4 (diff) | |
download | bcm5719-llvm-47035c0255f8544e35a208ab01fa0dbdbf7812ef.tar.gz bcm5719-llvm-47035c0255f8544e35a208ab01fa0dbdbf7812ef.zip |
Use VFS operations in FileManager::makeAbsolutePath.
Summary: It used to call into llvm::sys::fs::make_absolute.
Reviewers: akyrtzi, erikjv, bkramer, krasimir, klimek
Reviewed By: klimek
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D36155
llvm-svn: 309795
Diffstat (limited to 'clang/unittests/Basic/FileManagerTest.cpp')
-rw-r--r-- | clang/unittests/Basic/FileManagerTest.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/unittests/Basic/FileManagerTest.cpp b/clang/unittests/Basic/FileManagerTest.cpp index a19535e1047..a2a6c6aebe4 100644 --- a/clang/unittests/Basic/FileManagerTest.cpp +++ b/clang/unittests/Basic/FileManagerTest.cpp @@ -10,6 +10,7 @@ #include "clang/Basic/FileManager.h" #include "clang/Basic/FileSystemOptions.h" #include "clang/Basic/FileSystemStatCache.h" +#include "clang/Basic/VirtualFileSystem.h" #include "llvm/ADT/STLExtras.h" #include "llvm/Config/llvm-config.h" #include "llvm/Support/Path.h" @@ -296,4 +297,30 @@ TEST_F(FileManagerTest, getVirtualFileWithDifferentName) { #endif // !LLVM_ON_WIN32 +TEST_F(FileManagerTest, makeAbsoluteUsesVFS) { + SmallString<64> CustomWorkingDir; +#ifdef LLVM_ON_WIN32 + CustomWorkingDir = "C:"; +#else + CustomWorkingDir = "/"; +#endif + llvm::sys::path::append(CustomWorkingDir, "some", "weird", "path"); + + auto FS = + IntrusiveRefCntPtr<vfs::InMemoryFileSystem>(new vfs::InMemoryFileSystem); + // setCurrentworkingdirectory must finish without error. + ASSERT_TRUE(!FS->setCurrentWorkingDirectory(CustomWorkingDir)); + + FileSystemOptions Opts; + FileManager Manager(Opts, FS); + + SmallString<64> Path("a/foo.cpp"); + + SmallString<64> ExpectedResult(CustomWorkingDir); + llvm::sys::path::append(ExpectedResult, Path); + + ASSERT_TRUE(Manager.makeAbsolutePath(Path)); + EXPECT_EQ(Path, ExpectedResult); +} + } // anonymous namespace |