[PATCH] D20137: [PCH] Fixed bugs with preamble invalidation when files change (on Windows)
Cameron via cfe-commits
cfe-commits at lists.llvm.org
Tue May 17 07:41:10 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL269769: [PCH] Fixed bug with preamble invalidation when overridden files change (authored by cameron314).
Changed prior to commit:
http://reviews.llvm.org/D20137?vs=57367&id=57477#toc
Repository:
rL LLVM
http://reviews.llvm.org/D20137
Files:
cfe/trunk/lib/Frontend/ASTUnit.cpp
Index: cfe/trunk/lib/Frontend/ASTUnit.cpp
===================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp
@@ -1378,7 +1378,7 @@
// First, make a record of those files that have been overridden via
// remapping or unsaved_files.
- llvm::StringMap<PreambleFileHash> OverriddenFiles;
+ std::map<llvm::sys::fs::UniqueID, PreambleFileHash> OverriddenFiles;
for (const auto &R : PreprocessorOpts.RemappedFiles) {
if (AnyFileChanged)
break;
@@ -1391,24 +1391,38 @@
break;
}
- OverriddenFiles[R.first] = PreambleFileHash::createForFile(
+ OverriddenFiles[Status.getUniqueID()] = PreambleFileHash::createForFile(
Status.getSize(), Status.getLastModificationTime().toEpochTime());
}
for (const auto &RB : PreprocessorOpts.RemappedFileBuffers) {
if (AnyFileChanged)
break;
- OverriddenFiles[RB.first] =
+
+ vfs::Status Status;
+ if (FileMgr->getNoncachedStatValue(RB.first, Status)) {
+ AnyFileChanged = true;
+ break;
+ }
+
+ OverriddenFiles[Status.getUniqueID()] =
PreambleFileHash::createForMemoryBuffer(RB.second);
}
// Check whether anything has changed.
- for (llvm::StringMap<PreambleFileHash>::iterator
+ for (llvm::StringMap<PreambleFileHash>::iterator
F = FilesInPreamble.begin(), FEnd = FilesInPreamble.end();
!AnyFileChanged && F != FEnd;
++F) {
- llvm::StringMap<PreambleFileHash>::iterator Overridden
- = OverriddenFiles.find(F->first());
+ vfs::Status Status;
+ if (FileMgr->getNoncachedStatValue(F->first(), Status)) {
+ // If we can't stat the file, assume that something horrible happened.
+ AnyFileChanged = true;
+ break;
+ }
+
+ std::map<llvm::sys::fs::UniqueID, PreambleFileHash>::iterator Overridden
+ = OverriddenFiles.find(Status.getUniqueID());
if (Overridden != OverriddenFiles.end()) {
// This file was remapped; check whether the newly-mapped file
// matches up with the previous mapping.
@@ -1418,13 +1432,9 @@
}
// The file was not remapped; check whether it has changed on disk.
- vfs::Status Status;
- if (FileMgr->getNoncachedStatValue(F->first(), Status)) {
- // If we can't stat the file, assume that something horrible happened.
- AnyFileChanged = true;
- } else if (Status.getSize() != uint64_t(F->second.Size) ||
- Status.getLastModificationTime().toEpochTime() !=
- uint64_t(F->second.ModTime))
+ if (Status.getSize() != uint64_t(F->second.Size) ||
+ Status.getLastModificationTime().toEpochTime() !=
+ uint64_t(F->second.ModTime))
AnyFileChanged = true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20137.57477.patch
Type: text/x-patch
Size: 3037 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160517/76a27ce0/attachment.bin>
More information about the cfe-commits
mailing list