]> granicus.if.org Git - clang/commitdiff
Check the inode in addition to size and modification time to determine
authorDouglas Gregor <dgregor@apple.com>
Wed, 17 Mar 2010 15:33:06 +0000 (15:33 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 17 Mar 2010 15:33:06 +0000 (15:33 +0000)
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

lib/Basic/SourceManager.cpp

index 440e688cd736f57bb84c118873978a99639e509e..4c24d030b872ba3472239bf429819515e0934f7b 100644 (file)
@@ -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);
     }