forked from OSchip/llvm-project
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. llvm-svn: 41000
This commit is contained in:
parent
47fea35e48
commit
ac9823bc5d
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: clang -parse-ast-check %s
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void foo(FILE *FP) {}
|
Loading…
Reference in New Issue