From f65b0b5dcfeb04e9e6794b32a075432ce3de1ccd Mon Sep 17 00:00:00 2001 From: Ben Barham Date: Mon, 4 Apr 2022 16:38:46 -0700 Subject: Revert "[VFS] RedirectingFileSystem only replace path if not already mapped" This reverts commit 3fda0edc51fd68192a30e302d45db081bb02d7f9, which breaks crash reproducers in very specific circumstances. Specifically, since crash reproducers have `UseExternalNames` set to false, the `File->getFileEntry().getDir()->getName()` call in `DoFrameworkLookup` would use the *cached* directory name instead of the directory of the looked-up file. The plan is to re-commit this patch but to *add* `ExposesExternalVFSPath` rather than replace `IsVFSMapped`. Differential Revision: https://reviews.llvm.org/D123103 --- llvm/lib/Support/VirtualFileSystem.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'llvm/lib/Support/VirtualFileSystem.cpp') diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp index 14e9f0277f98..cb34fa60d801 100644 --- a/llvm/lib/Support/VirtualFileSystem.cpp +++ b/llvm/lib/Support/VirtualFileSystem.cpp @@ -2163,16 +2163,10 @@ 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); - else - S.ExposesExternalVFSPath = true; + S.IsVFSMapped = true; return S; } @@ -2274,9 +2268,7 @@ public: ErrorOr> File::getWithPath(ErrorOr> Result, const Twine &P) { - // See \c getRedirectedFileStatus - don't update path if it's already been - // mapped. - if (!Result || (*Result)->status()->ExposesExternalVFSPath) + if (!Result) return Result; ErrorOr> F = std::move(*Result); -- cgit v1.2.3