[PATCH] D130935: [clang] Only modify FileEntryRef names that are externally remapped

Ben Langmuir via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 1 14:04:17 PDT 2022


benlangmuir added inline comments.


================
Comment at: clang/lib/Basic/FileManager.cpp:277-278
 
-  if (Status.getName() == Filename) {
-    // The name matches. Set the FileEntry.
+  if (Status.getName() == Filename || !Status.ExposesExternalVFSPath) {
+    // Use the requested name. Set the FileEntry.
     NamedFileEnt->second = FileEntryRef::MapValue(*UFE, DirInfo);
----------------
bnbarham wrote:
> Is it possible for an `ExposesExternalVFSPath` to have the same filename as the one that was requested? Just in the case of mapping `A -> A` or something equally pointless? Could check for that in the VFS, but probably doesn't matter in the long run.
I think in practice it won't happen, but in theory the VFS can do whatever it wants, so I didn't want to introduce any possibility of circularity here.  I will flip these checks so the boolean comes before the string compare though, since that will be cheaper.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130935/new/

https://reviews.llvm.org/D130935



More information about the cfe-commits mailing list