]> granicus.if.org Git - clang/commitdiff
Use a simple diagnostic (file modified) when we detect that a file has
authorDouglas Gregor <dgregor@apple.com>
Wed, 17 Mar 2010 15:30:15 +0000 (15:30 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 17 Mar 2010 15:30:15 +0000 (15:30 +0000)
changed, rather than trying to point out how it changed. The "why"
doesn't matter.

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

include/clang/Basic/DiagnosticCommonKinds.td
lib/Basic/SourceManager.cpp
test/PCH/changed-files.c

index 849e6437fbe6d9837247c180ae9ef2f957844bae..8e791c3422fc3e8697466ca6ed701e1600f01dc8 100644 (file)
@@ -65,9 +65,6 @@ def err_target_invalid_feature : Error<"invalid target feature '%0'">;
 
 // Source manager
 def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal;
-def err_file_size_changed : Error<
-  "size of file '%0' changed since it was first processed (from %1 to %2)">, 
-  DefaultFatal;
 def err_file_modified : Error<
   "file '%0' modified since it was first processed">, DefaultFatal;
   
index be7c256b5b1b750c656981d23d6186049ca85e3d..440e688cd736f57bb84c118873978a99639e509e 100644 (file)
@@ -92,18 +92,12 @@ const llvm::MemoryBuffer *ContentCache::getBuffer(Diagnostic &Diag,
       Diag.Report(diag::err_cannot_open_file)
         << Entry->getName() << ErrorStr;
       Buffer.setInt(true);
-    } else {
+    } 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).
-      if (FileInfo.st_size != Entry->getSize()) {
-        Diag.Report(diag::err_file_size_changed)
-          << Entry->getName() << (unsigned)Entry->getSize() 
-          << (unsigned)FileInfo.st_size;
-        Buffer.setInt(true);
-      } else if (FileInfo.st_mtime != Entry->getModificationTime()) {
-        Diag.Report(diag::err_file_modified) << Entry->getName();
-        Buffer.setInt(true);
-      }
+      Diag.Report(diag::err_file_modified) << Entry->getName();
+      Buffer.setInt(true);
     }
   }
   
index ec4f5b4b1d31a309bc256b102aeafb0ef223a068..5bcb977d12070c4da06a95c7a3d36fa71cea1afe 100644 (file)
@@ -6,17 +6,17 @@ const char *s2 = m0;
 // RUN: %clang_cc1 -emit-pch -o %t.h.pch %t.h
 // RUN: echo '' > %t.h
 // RUN: not %clang_cc1 -include-pch %t.h.pch %s 2> %t.stderr
-// RUN: grep "size of file" %t.stderr
+// RUN: grep "modified" %t.stderr
 
 // RUN: echo '#define m0 000' > %t.h
 // RUN: %clang_cc1 -emit-pch -o %t.h.pch %t.h
 // RUN: echo '' > %t.h
 // RUN: not %clang_cc1 -include-pch %t.h.pch %s 2> %t.stderr
-// RUN: grep "size of file" %t.stderr
+// RUN: grep "modified" %t.stderr
 
 // RUN: echo '#define m0 000' > %t.h
 // RUN: echo "#define m1 'abcd'" >> %t.h
 // RUN: %clang_cc1 -emit-pch -o %t.h.pch %t.h
 // RUN: echo '' > %t.h
 // RUN: not %clang_cc1 -include-pch %t.h.pch %s 2> %t.stderr
-// RUN: grep "size of file" %t.stderr
+// RUN: grep "modified" %t.stderr