[PATCH] Default getFile() to use the last accessed name in the FileEntry.

Manuel Klimek klimek at google.com
Tue Aug 12 01:49:18 PDT 2014


Hi rsmith,

With modules we start accessing headers for the first time while
reading the module map, which often has very different paths from the include
scanning logic.

Using the name by which the file was accessed gets us one step closer to the
right solution, which is using a FileName abstraction that decouples the name
by which a file was accessed from the FileEntry.

http://reviews.llvm.org/D4864

Files:
  lib/Basic/FileManager.cpp

Index: lib/Basic/FileManager.cpp
===================================================================
--- lib/Basic/FileManager.cpp
+++ lib/Basic/FileManager.cpp
@@ -281,6 +281,13 @@
     if (DirInfo != UFE.Dir && Data.IsVFSMapped)
       UFE.Dir = DirInfo;
 
+    // Always update the name to use the last name by which a file was accessed.
+    // FIXME: Neither this nor always using the first name is correct; we want
+    // to switch towards a design where we return a FileName object that
+    // encapsulates both the name by which the file was accessed and the
+    // corresponding FileEntry.
+    UFE.Name = Data.Name;
+
     return &UFE;
   }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4864.12388.patch
Type: text/x-patch
Size: 656 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140812/bb4a1109/attachment.bin>


More information about the cfe-commits mailing list