[PATCH] D109128: [VFS] Use original path when falling back to external FS

Keith Smiley via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 1 21:19:59 PDT 2021


keith updated this revision to Diff 370155.
keith added a comment.

Some of the other checks were invalid given the current tests, these seem to be enough to solve this issue without breaking existing tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109128/new/

https://reviews.llvm.org/D109128

Files:
  clang/test/VFS/relative-path-errors.c
  llvm/lib/Support/VirtualFileSystem.cpp


Index: llvm/lib/Support/VirtualFileSystem.cpp
===================================================================
--- llvm/lib/Support/VirtualFileSystem.cpp
+++ llvm/lib/Support/VirtualFileSystem.cpp
@@ -2013,7 +2013,7 @@
   ErrorOr<RedirectingFileSystem::LookupResult> 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;
   }
 
Index: clang/test/VFS/relative-path-errors.c
===================================================================
--- /dev/null
+++ 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109128.370155.patch
Type: text/x-patch
Size: 1240 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210902/3ed5a5c5/attachment.bin>


More information about the llvm-commits mailing list