Revert "[VFS] RedirectingFileSystem only replace path if not already mapped"

This reverts commit 3fda0edc51, 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
This commit is contained in:
Ben Barham committed 2022-04-05 14:24:40 -07:00
1 parent c2f6460145
commit f65b0b5dcf
5 files changed
+38 -104

No files matched your search

+2 -10
View File
@@ -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<std::unique_ptr<File>>
File::getWithPath(ErrorOr<std::unique_ptr<File>> 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<std::unique_ptr<File>> F = std::move(*Result);