summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-03-17 15:33:06 +0000
committerDouglas Gregor <dgregor@apple.com>2010-03-17 15:33:06 +0000
commit22fde23b6e125317828d7c07b86c8e7be16440a5 (patch)
tree0a1bed75e92550a6288a2a8491d550c2ddfd2599 /clang/lib/Basic/SourceManager.cpp
parent6597f5950650060aeea7969057587e6180dd8e71 (diff)
downloadbcm5719-llvm-22fde23b6e125317828d7c07b86c8e7be16440a5.tar.gz
bcm5719-llvm-22fde23b6e125317828d7c07b86c8e7be16440a5.zip
Check the inode in addition to size and modification time to determine
whether a file has changed since it was originally read. llvm-svn: 98726
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r--clang/lib/Basic/SourceManager.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index 440e688cd73..4c24d030b87 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -93,9 +93,11 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag,
<< Entry->getName() << ErrorStr;
Buffer.setInt(true);
} else if (FileInfo.st_size != Entry->getSize() ||
- FileInfo.st_mtime != Entry->getModificationTime()) {
- // Check that the file's size and modification time is the same as
- // in the file entry (which may have come from a stat cache).
+ FileInfo.st_mtime != Entry->getModificationTime() ||
+ FileInfo.st_ino != Entry->getInode()) {
+ // Check that the file's size, modification time, and inode are
+ // the same as in the file entry (which may have come from a
+ // stat cache).
Diag.Report(diag::err_file_modified) << Entry->getName();
Buffer.setInt(true);
}
OpenPOWER on IntegriCloud