[all-commits] [llvm/llvm-project] fe2478: [VFS] RedirectingFileSystem only replace path if n...

Ben Barham via All-commits all-commits at lists.llvm.org
Mon Apr 11 14:53:33 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fe2478d44e4f7f191c43fef629ac7a23d0251e72
  Author: Ben Barham <ben_barham at apple.com>
  Date:   2022-04-11 (Mon, 11 Apr 2022)

  Changed paths:
    M clang/lib/Basic/FileManager.cpp
    A clang/test/VFS/external-names-multi-overlay.c
    M llvm/include/llvm/Support/VirtualFileSystem.h
    M llvm/lib/Support/VirtualFileSystem.cpp
    M llvm/unittests/Support/VirtualFileSystemTest.cpp

  Log Message:
  [VFS] RedirectingFileSystem only replace path if not already mapped

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.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D123398

More information about the All-commits mailing list