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

Ben Barham via All-commits all-commits at lists.llvm.org
Wed Mar 30 11:56:00 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3fda0edc51fd68192a30e302d45db081bb02d7f9
      https://github.com/llvm/llvm-project/commit/3fda0edc51fd68192a30e302d45db081bb02d7f9
  Author: Ben Barham <ben_barham at apple.com>
  Date:   2022-03-30 (Wed, 30 Mar 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 a path then the
`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).

This also renames `IsVFSMapped` to `ExposesExternalVFSPath` and only
sets it if `UseExternalName` is true. This flag then represents that the
`Status` has an external path that's different from its virtual path.
Right now the contained path is still the external path, but further PRs
will change this to *always* be the virtual path. Clients that need the
external can then request it specifically.

Note that even though `ExposesExternalVFSPath` isn't set for all
VFS-mapped paths, `IsVFSMapped` was only being used by a hack in
`FileManager` that was specific to module searching. In that case
`UseExternalNames` is always `true` and so that hack still applies.

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

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




More information about the All-commits mailing list