From 26da1f46e4c892d3705a12fb7667637e4af4259a Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Sun, 24 Aug 2008 12:51:04 +0000 Subject: [PATCH] Add a Parser::Diag overload that can receive a custom string along with a SourceRange. llvm-svn: 55283 --- clang/include/clang/Parse/Parser.h | 2 ++ clang/lib/Parse/Parser.cpp | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h index f74960425add..6f9ca22ba96a 100644 --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -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); diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index a5fe551bfecc..c6b0a80e02eb 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -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);