diff --git a/clang/test/VFS/relative-path-errors.c b/clang/test/VFS/relative-path-errors.c new file mode 100644 --- /dev/null +++ b/clang/test/VFS/relative-path-errors.c @@ -0,0 +1,8 @@ +// RUN: mkdir -p %t +// RUN: cd %t +// RUN: echo '{"roots": [],"version": 0}' > %t.yaml +// RUN: cp %s main.c +// RUN: not %clang_cc1 -ivfsoverlay %t.yaml main.c 2>&1 | FileCheck %s + +// CHECK: {{^}}main.c:8:1: error: +foobarbaz diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -2013,7 +2013,7 @@ ErrorOr Result = lookupPath(Path); if (!Result) { if (shouldFallBackToExternalFS(Result.getError())) - return ExternalFS->openFileForRead(Path); + return ExternalFS->openFileForRead(Path_); return Result.getError(); } @@ -2026,7 +2026,7 @@ auto ExternalFile = ExternalFS->openFileForRead(ExtRedirect); if (!ExternalFile) { if (shouldFallBackToExternalFS(ExternalFile.getError(), Result->E)) - return ExternalFS->openFileForRead(Path); + return ExternalFS->openFileForRead(Path_); return ExternalFile; }