[cfe-commits] r41000 - in /cfe/trunk: Driver/DiagChecker.cpp test/Misc/ test/Misc/diag-checker.c
Chris Lattner
sabre at nondot.org
Fri Aug 10 11:27:41 PDT 2007
Author: lattner
Date: Fri Aug 10 13:27:41 2007
New Revision: 41000
URL: http://llvm.org/viewvc/llvm-project?rev=41000&view=rev
Log:
Build ASTs before relexing the file. This avoids having comment finding mutate the
preprocessor state, causing bogus diagnostics when the file is parsed for real. This
implements Misc/diag-checker.c. Thanks to Ted for noticing this.
Added:
cfe/trunk/test/Misc/
cfe/trunk/test/Misc/diag-checker.c
Modified:
cfe/trunk/Driver/DiagChecker.cpp
Modified: cfe/trunk/Driver/DiagChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/DiagChecker.cpp?rev=41000&r1=40999&r2=41000&view=diff
==============================================================================
--- cfe/trunk/Driver/DiagChecker.cpp (original)
+++ cfe/trunk/Driver/DiagChecker.cpp Fri Aug 10 13:27:41 2007
@@ -216,13 +216,13 @@
/// CheckDiagnostics - Implement the -parse-ast-check diagnostic verifier.
bool clang::CheckDiagnostics(Preprocessor &PP, unsigned MainFileID) {
+ // Parse the specified input file.
+ BuildASTs(PP, MainFileID, false);
+
// Gather the set of expected diagnostics.
DiagList ExpectedErrors, ExpectedWarnings;
FindExpectedDiags(PP, MainFileID, ExpectedErrors, ExpectedWarnings);
- // Parse the specified input file.
- BuildASTs(PP, MainFileID, false);
-
// Check that the expected diagnostics occurred.
return CheckResults(PP, ExpectedErrors, ExpectedWarnings);
}
Added: cfe/trunk/test/Misc/diag-checker.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/diag-checker.c?rev=41000&view=auto
==============================================================================
--- cfe/trunk/test/Misc/diag-checker.c (added)
+++ cfe/trunk/test/Misc/diag-checker.c Fri Aug 10 13:27:41 2007
@@ -0,0 +1,5 @@
+// RUN: clang -parse-ast-check %s
+
+#include <stdio.h>
+
+void foo(FILE *FP) {}
More information about the cfe-commits
mailing list