diff options
author | Chris Lattner <sabre@nondot.org> | 2007-08-10 18:27:41 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-08-10 18:27:41 +0000 |
commit | 009e9f7e456de974ac457df6614cd2f87b7480dd (patch) | |
tree | ceeed44c67b83c18b3f36a84d5c45f9276b1cdd4 | |
parent | 30bf7710b5c64deb318752343bb80a70b3c53429 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41000 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Driver/DiagChecker.cpp | 6 | ||||
-rw-r--r-- | test/Misc/diag-checker.c | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/Driver/DiagChecker.cpp b/Driver/DiagChecker.cpp index 279b55b773..1e327ce363 100644 --- a/Driver/DiagChecker.cpp +++ b/Driver/DiagChecker.cpp @@ -216,13 +216,13 @@ static bool CheckResults(Preprocessor &PP, /// 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); } diff --git a/test/Misc/diag-checker.c b/test/Misc/diag-checker.c new file mode 100644 index 0000000000..2aa5051d8b --- /dev/null +++ b/test/Misc/diag-checker.c @@ -0,0 +1,5 @@ +// RUN: clang -parse-ast-check %s + +#include <stdio.h> + +void foo(FILE *FP) {} |