forked from OSchip/llvm-project
parent
23e6353835
commit
0d21046a7e
|
@ -42,7 +42,6 @@ static const char * const ExpectedWarnStr = "expected-warning";
|
||||||
/// diagnostics. If so, then put them in a diagnostic list.
|
/// diagnostics. If so, then put them in a diagnostic list.
|
||||||
///
|
///
|
||||||
static void FindDiagnostics(const std::string &Comment,
|
static void FindDiagnostics(const std::string &Comment,
|
||||||
const TextDiagnosticBuffer &DiagClient,
|
|
||||||
DiagList &ExpectedDiags,
|
DiagList &ExpectedDiags,
|
||||||
SourceManager &SourceMgr,
|
SourceManager &SourceMgr,
|
||||||
SourceLocation Pos,
|
SourceLocation Pos,
|
||||||
|
@ -86,8 +85,7 @@ static void FindDiagnostics(const std::string &Comment,
|
||||||
/// called later to report any discrepencies between the diagnostics expected
|
/// called later to report any discrepencies between the diagnostics expected
|
||||||
/// and those actually seen.
|
/// and those actually seen.
|
||||||
///
|
///
|
||||||
static void ProcessFileDiagnosticChecking(const TextDiagnosticBuffer&DiagClient,
|
static void ProcessFileDiagnosticChecking(Preprocessor &PP,
|
||||||
Preprocessor &PP,
|
|
||||||
unsigned MainFileID,
|
unsigned MainFileID,
|
||||||
DiagList &ExpectedErrors,
|
DiagList &ExpectedErrors,
|
||||||
DiagList &ExpectedWarnings) {
|
DiagList &ExpectedWarnings) {
|
||||||
|
@ -105,12 +103,12 @@ static void ProcessFileDiagnosticChecking(const TextDiagnosticBuffer&DiagClient,
|
||||||
std::string Comment = PP.getSpelling(Tok);
|
std::string Comment = PP.getSpelling(Tok);
|
||||||
|
|
||||||
// Find all expected errors
|
// Find all expected errors
|
||||||
FindDiagnostics(Comment, DiagClient, ExpectedErrors,PP.getSourceManager(),
|
FindDiagnostics(Comment, ExpectedErrors,PP.getSourceManager(),
|
||||||
Tok.getLocation(), ExpectedErrStr);
|
Tok.getLocation(), ExpectedErrStr);
|
||||||
|
|
||||||
// Find all expected warnings
|
// Find all expected warnings
|
||||||
FindDiagnostics(Comment, DiagClient, ExpectedWarnings,
|
FindDiagnostics(Comment, ExpectedWarnings, PP.getSourceManager(),
|
||||||
PP.getSourceManager(),Tok.getLocation(), ExpectedWarnStr);
|
Tok.getLocation(), ExpectedWarnStr);
|
||||||
}
|
}
|
||||||
} while (Tok.getKind() != tok::eof);
|
} while (Tok.getKind() != tok::eof);
|
||||||
|
|
||||||
|
@ -223,14 +221,13 @@ static bool ReportCheckingResults(const TextDiagnosticBuffer &DiagClient,
|
||||||
|
|
||||||
/// CheckDiagnostics - Implement the -parse-ast-check diagnostic verifier.
|
/// CheckDiagnostics - Implement the -parse-ast-check diagnostic verifier.
|
||||||
bool clang::CheckDiagnostics(Preprocessor &PP, unsigned MainFileID) {
|
bool clang::CheckDiagnostics(Preprocessor &PP, unsigned MainFileID) {
|
||||||
const TextDiagnosticBuffer &Diags =
|
|
||||||
static_cast<const TextDiagnosticBuffer&>(PP.getDiagnostics().getClient());
|
|
||||||
|
|
||||||
// Gather the set of expected diagnostics.
|
// Gather the set of expected diagnostics.
|
||||||
DiagList ExpectedErrors, ExpectedWarnings;
|
DiagList ExpectedErrors, ExpectedWarnings;
|
||||||
ProcessFileDiagnosticChecking(Diags, PP, MainFileID, ExpectedErrors,
|
ProcessFileDiagnosticChecking(PP, MainFileID, ExpectedErrors,
|
||||||
ExpectedWarnings);
|
ExpectedWarnings);
|
||||||
|
|
||||||
|
const TextDiagnosticBuffer &Diags =
|
||||||
|
static_cast<const TextDiagnosticBuffer&>(PP.getDiagnostics().getClient());
|
||||||
|
|
||||||
return ReportCheckingResults(Diags, ExpectedErrors,
|
return ReportCheckingResults(Diags, ExpectedErrors,
|
||||||
ExpectedWarnings, PP.getSourceManager());
|
ExpectedWarnings, PP.getSourceManager());
|
||||||
|
|
Loading…
Reference in New Issue