diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-03-17 15:33:06 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-03-17 15:33:06 +0000 |
commit | 0419a2375f16821e40ea48e5437fefe6a803f26d (patch) | |
tree | 04497f279ff79b6fc84c7686657af7b544a65a38 | |
parent | e39b600582f9183e3301c3e6cb48b76ac5087119 (diff) |
Check the inode in addition to size and modification time to determine
whether a file has changed since it was originally read.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98726 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Basic/SourceManager.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Basic/SourceManager.cpp b/lib/Basic/SourceManager.cpp index 440e688cd7..4c24d030b8 100644 --- a/lib/Basic/SourceManager.cpp +++ b/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); } |