Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/Support/VirtualFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2204,7 +2204,7 @@ RedirectingFileSystem::create(std::unique_ptr<MemoryBuffer> Buffer,
// FS->OverlayFileDir => /<absolute_path_to>/dummy.cache/vfs
//
SmallString<256> OverlayAbsDir = sys::path::parent_path(YAMLFilePath);
std::error_code EC = llvm::sys::fs::make_absolute(OverlayAbsDir);
std::error_code EC = ExternalFS->makeAbsolute(OverlayAbsDir);
assert(!EC && "Overlay dir final path must be absolute");
(void)EC;
FS->setOverlayFileDir(OverlayAbsDir);
Expand Down
23 changes: 23 additions & 0 deletions llvm/unittests/Support/VirtualFileSystemTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1941,6 +1941,29 @@ TEST_F(VFSFromYAMLTest, ReturnsExternalPathVFSHit) {
EXPECT_EQ(0, NumDiagnostics);
}

TEST_F(VFSFromYAMLTest, RelativeFileDirWithOverlayRelativeSetting) {
auto Lower = makeIntrusiveRefCnt<DummyFileSystem>();
Lower->addDirectory("//root/foo/bar");
Lower->addRegularFile("//root/foo/bar/a");
Lower->setCurrentWorkingDirectory("//root/foo");
IntrusiveRefCntPtr<vfs::FileSystem> FS =
getFromYAMLString("{\n"
" 'case-sensitive': false,\n"
" 'overlay-relative': true,\n"
" 'roots': [\n"
" { 'name': '//root/foo/bar/b', 'type': 'file',\n"
" 'external-contents': 'a'\n"
" }\n"
" ]\n"
"}",
Lower, "bar/overlay");

ASSERT_NE(FS.get(), nullptr);
ErrorOr<vfs::Status> S = FS->status("//root/foo/bar/b");
ASSERT_FALSE(S.getError());
EXPECT_EQ("//root/foo/bar/a", S->getName());
}

TEST_F(VFSFromYAMLTest, RootRelativeToOverlayDirTest) {
auto Lower = makeIntrusiveRefCnt<DummyFileSystem>();
Lower->addDirectory("//root/foo/bar");
Expand Down
Loading