]> granicus.if.org Git - clang/commitdiff
On Windows, disable the modification-time check for files used in
authorDouglas Gregor <dgregor@apple.com>
Fri, 9 Apr 2010 15:54:22 +0000 (15:54 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 9 Apr 2010 15:54:22 +0000 (15:54 +0000)
precompiled headers and/or when reading the contents of the file into
memory. These checks seem to be causing spurious regression-test
failures on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100866 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/SourceManager.cpp
lib/Frontend/PCHReader.cpp

index 27cb9bebde42286296233961761b2fae0bb0fd7f..27a859c9d752068d39efc8f3ccb72da8cc477a17 100644 (file)
@@ -98,11 +98,17 @@ 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, modification time, and inode are
-      // the same as in the file entry (which may have come from a
-      // stat cache).
+    } else if (FileInfo.st_size != Entry->getSize()
+#if !defined(LLVM_ON_WIN32)
+               // In our regression testing, the Windows file system
+               // seems to have inconsistent modification times that
+               // sometimes erroneously trigger this error-handling
+               // path.
+               || FileInfo.st_mtime != Entry->getModificationTime()
+#endif
+               ) {
+      // Check that the file's size and modification time are the same
+      // as in the file entry (which may have come from a stat cache).
       if (Diag.isDiagnosticInFlight())
         Diag.SetDelayedDiagnostic(diag::err_file_modified, 
                                   Entry->getName());
index 41e06661fabe294f3f33abb5a0582649a0d0d33a..578c047b00540dead4746ac963d23eee09aab85a 100644 (file)
@@ -910,8 +910,14 @@ PCHReader::PCHReadResult PCHReader::ReadSLocEntryRecord(unsigned ID) {
       return Failure;
     }
 
-    if ((off_t)Record[4] != File->getSize() ||
-        (time_t)Record[5] != File->getModificationTime()) {
+    if ((off_t)Record[4] != File->getSize()
+#if !defined(LLVM_ON_WIN32)
+        // In our regression testing, the Windows file system seems to
+        // have inconsistent modification times that sometimes
+        // erroneously trigger this error-handling path.
+        || (time_t)Record[5] != File->getModificationTime()
+#endif
+        ) {
       Diag(diag::err_fe_pch_file_modified)
         << Filename;
       return Failure;