Add a Parser::Diag overload that can receive a custom string along with a SourceRange.

llvm-svn: 55283
This commit is contained in:
Argyrios Kyrtzidis 2008-08-24 12:51:04 +00:00
parent 404cd15fa5
commit 26da1f46e4
2 changed files with 8 additions and 0 deletions

View File

@ -245,6 +245,8 @@ private:
bool Diag(SourceLocation Loc, unsigned DiagID,
const std::string &Msg = std::string());
bool Diag(SourceLocation Loc, unsigned DiagID, const SourceRange &R);
bool Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
SourceRange R1);
bool Diag(const Token &Tok, unsigned DiagID,
const std::string &M = std::string()) {
return Diag(Tok.getLocation(), DiagID, M);

View File

@ -38,6 +38,12 @@ bool Parser::Diag(SourceLocation Loc, unsigned DiagID,
return true;
}
bool Parser::Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg,
SourceRange Range) {
Diags.Report(PP.getFullLoc(Loc), DiagID, &Msg, 1, &Range,1);
return true;
}
bool Parser::Diag(SourceLocation Loc, unsigned DiagID, const SourceRange &R) {
Diags.Report(FullSourceLoc(Loc,PP.getSourceManager()), DiagID, 0, 0,
&R, 1);