[cfe-commits] r98725 - in /cfe/trunk: include/clang/Basic/DiagnosticCommonKinds.td lib/Basic/SourceManager.cpp test/PCH/changed-files.c
Douglas Gregor
dgregor at apple.com
Wed Mar 17 08:30:15 PDT 2010
Author: dgregor
Date: Wed Mar 17 10:30:15 2010
New Revision: 98725
URL: http://llvm.org/viewvc/llvm-project?rev=98725&view=rev
Log:
Use a simple diagnostic (file modified) when we detect that a file has
changed, rather than trying to point out how it changed. The "why"
doesn't matter.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
cfe/trunk/lib/Basic/SourceManager.cpp
cfe/trunk/test/PCH/changed-files.c
Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=98725&r1=98724&r2=98725&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Wed Mar 17 10:30:15 2010
@@ -65,9 +65,6 @@
// 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;
Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=98725&r1=98724&r2=98725&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Wed Mar 17 10:30:15 2010
@@ -92,18 +92,12 @@
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);
}
}
Modified: cfe/trunk/test/PCH/changed-files.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/changed-files.c?rev=98725&r1=98724&r2=98725&view=diff
==============================================================================
--- cfe/trunk/test/PCH/changed-files.c (original)
+++ cfe/trunk/test/PCH/changed-files.c Wed Mar 17 10:30:15 2010
@@ -6,17 +6,17 @@
// 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
More information about the cfe-commits
mailing list