[PATCH] D20137: [PCH] Fixed bugs with preamble invalidation when files change (on Windows)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Fri May 13 11:32:07 PDT 2016


rsmith added inline comments.

================
Comment at: lib/Basic/FileManager.cpp:304-307
@@ -303,1 +303,6 @@
 
+  if (UFE.isVirtual()) {
+    UFE.Name = InterndFileName;
+    return &UFE;
+  }
+
----------------
It looks like this is unreachable: `IsVirtual` is only ever `true` when `IsValid` is also `true`, and we don't reach this line if `UFE.isValid()`. As this is the only consumer of `FileEntry::IsValid`, it looks like it does nothing. Am I missing something?

================
Comment at: lib/Frontend/ASTUnit.cpp:1402-1406
@@ +1401,7 @@
+
+        vfs::Status Status;
+        if (FileMgr->getNoncachedStatValue(RB.first, Status)) {
+          AnyFileChanged = true;
+          break;
+        }
+
----------------
If there are multiple file names with the same inode, `RB.first` is an arbitrarily-chosen one of those names, and stat'ing it isn't sufficient to check that none of the other names for the file have changed. Maybe we need to store a list of filenames used for each `UniqueID`?


http://reviews.llvm.org/D20137





More information about the cfe-commits mailing list