Skip to content

Conversation

@jansvoboda11
Copy link
Contributor

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.

@llvmbot
Copy link
Member

llvmbot commented Sep 26, 2025

@llvm/pr-subscribers-llvm-support

Author: Jan Svoboda (jansvoboda11)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/160943.diff

1 Files Affected:

  • (modified) llvm/lib/Support/FileCollector.cpp (+2-3)
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 {

Copy link
Collaborator

@cachemeifyoucan cachemeifyoucan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Seems like a simple improvement.

@jansvoboda11 jansvoboda11 merged commit f9dbf73 into llvm:main Sep 29, 2025
9 of 11 checks passed
@jansvoboda11 jansvoboda11 deleted the file-collector-real-path-vfs branch September 29, 2025 16:00
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
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.
jansvoboda11 added a commit to swiftlang/llvm-project that referenced this pull request Oct 18, 2025
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.
jansvoboda11 added a commit to swiftlang/llvm-project that referenced this pull request Oct 23, 2025
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants