From: Chris Lattner Date: Sat, 26 Jul 2008 00:16:04 +0000 (+0000) Subject: add a new diag helper that takes a range. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=844cef32e4359c3e651e4eb84beca0c3e8a727d5;p=clang add a new diag helper that takes a range. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54081 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h index 0287120f0f..a4033a0ca6 100644 --- a/include/clang/Parse/Parser.h +++ b/include/clang/Parse/Parser.h @@ -246,6 +246,7 @@ private: void Diag(SourceLocation Loc, unsigned DiagID, const std::string &Msg = std::string()); + void Diag(SourceLocation Loc, unsigned DiagID, const SourceRange &R); void Diag(const Token &Tok, unsigned DiagID, const std::string &M = std::string()) { Diag(Tok.getLocation(), DiagID, M); diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 281459a300..ef07d3f08b 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -36,6 +36,12 @@ void Parser::Diag(SourceLocation Loc, unsigned DiagID, Diags.Report(FullSourceLoc(Loc,PP.getSourceManager()), DiagID, &Msg, 1); } +void Parser::Diag(SourceLocation Loc, unsigned DiagID, const SourceRange &R) { + Diags.Report(FullSourceLoc(Loc,PP.getSourceManager()), DiagID, 0, 0, + &R, 1); +} + + /// MatchRHSPunctuation - For punctuation with a LHS and RHS (e.g. '['/']'), /// this helper function matches and consumes the specified RHS token if /// present. If not present, it emits the specified diagnostic indicating