diff options
Diffstat (limited to 'llvm/lib/Support/VirtualFileSystem.cpp')
-rw-r--r-- | llvm/lib/Support/VirtualFileSystem.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp index cb34fa60..14e9f02 100644 --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -2163,10 +2163,16 @@ RedirectingFileSystem::lookupPathImpl( static Status getRedirectedFileStatus(const Twine &OriginalPath, bool UseExternalNames, Status ExternalStatus) { + // The path has been mapped by some nested VFS, don't override it with the + // original path. + if (ExternalStatus.ExposesExternalVFSPath) + return ExternalStatus; + Status S = ExternalStatus; if (!UseExternalNames) S = Status::copyWithNewName(S, OriginalPath); - S.IsVFSMapped = true; + else + S.ExposesExternalVFSPath = true; return S; } @@ -2268,7 +2274,9 @@ public: ErrorOr<std::unique_ptr<File>> File::getWithPath(ErrorOr<std::unique_ptr<File>> Result, const Twine &P) { - if (!Result) + // See \c getRedirectedFileStatus - don't update path if it's already been + // mapped. + if (!Result || (*Result)->status()->ExposesExternalVFSPath) return Result; ErrorOr<std::unique_ptr<File>> F = std::move(*Result); |