[llvm] [llvm] Use the VFS to get the real path in `FileCollector` (PR #160943)

Jan Svoboda via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 26 13:33:39 PDT 2025


https://github.com/jansvoboda11 created https://github.com/llvm/llvm-project/pull/160943

This PR starts using the correct VFS for getting file's real path in `FileCollector` instead of using the real FS directly. This matches compiler's behavior for other input files.

>From d83441ad2ae4e0ac212c7f421178ebf30c14b84d Mon Sep 17 00:00:00 2001
From: Jan Svoboda <jan_svoboda at apple.com>
Date: Fri, 26 Sep 2025 13:32:11 -0700
Subject: [PATCH] [llvm] Use the VFS to get the real path in FileCollector

---
 llvm/lib/Support/FileCollector.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Support/FileCollector.cpp b/llvm/lib/Support/FileCollector.cpp
index 5dc224a6d427b..1e5de2c49a2b3 100644
--- a/llvm/lib/Support/FileCollector.cpp
+++ b/llvm/lib/Support/FileCollector.cpp
@@ -68,9 +68,8 @@ void FileCollector::PathCanonicalizer::updateWithRealPath(
   SmallString<256> RealPath;
   auto DirWithSymlink = CachedDirs.find(Directory);
   if (DirWithSymlink == CachedDirs.end()) {
-    // FIXME: Should this be a call to FileSystem::getRealpath(), in some
-    // cases? What if there is nothing on disk?
-    if (sys::fs::real_path(Directory, RealPath))
+    // FIXME: What if there is nothing on disk?
+    if (VFS->getRealPath(Directory, RealPath))
       return;
     CachedDirs[Directory] = std::string(RealPath);
   } else {



More information about the llvm-commits mailing list