Page MenuHomePhabricator

[VFS] RedirectingFileSystem only replace path if not already mapped
ClosedPublic

Authored by bnbarham on Apr 8 2022, 9:04 AM.

Details

Summary

If the ExternalFS has already remapped to an external path then
RedirectingFileSystem should not change it to the originally provided
path. This fixes the original path always being used if multiple VFS
overlays were provided and the path wasn't found in the highest (ie.
first in the chain).

For now this is accomplished through the use of a new
ExposesExternalVFSPath field on vfs::Status. This flag is true when
the Status has an external path that's different from its virtual
path, ie. the contained path is the external path. See the plan in
FileManager::getFileRef for where this is going - eventually we won't
need IsVFSMapped any more and all returned paths should be virtual.

Resolves rdar://90578880 and llvm-project#53306.

Diff Detail

Event Timeline

bnbarham created this revision.Apr 8 2022, 9:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 8 2022, 9:04 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
bnbarham requested review of this revision.Apr 8 2022, 9:04 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 8 2022, 9:04 AM

Does clang/test/VFS/external-names-multi-overlay.c need to be formatted or is it fine? It uses split-file so I'd really like to avoid the format here (makes it pretty silly).

Does clang/test/VFS/external-names-multi-overlay.c need to be formatted or is it fine? It uses split-file so I'd really like to avoid the format here (makes it pretty silly).

Seems fine to ignore. If it bothers you I think you can add a comment to silence it (I'm not sure how to spell it, but probably something similar to // clang-format off).

This revision is now accepted and ready to land.Apr 11 2022, 10:42 AM
This revision was landed with ongoing or failed builds.Apr 11 2022, 2:53 PM
This revision was automatically updated to reflect the committed changes.