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
This commit is contained in:
Douglas Gregor 2010-03-17 15:33:06 +00:00
parent 6597f59506
commit 22fde23b6e
1 changed files with 5 additions and 3 deletions

View 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);
}