diff options
author | Chris Lattner <sabre@nondot.org> | 2008-11-18 07:48:38 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-11-18 07:48:38 +0000 |
commit | 1ab3b96de160e4fbffec2a776e284a48a3bb543d (patch) | |
tree | 9ab728aaab0602c9e14a93602a50d62932a74f5e /lib/Parse/ParseExprCXX.cpp | |
parent | d3b64655fa81ff1e1d5f944198239e4908035d79 (diff) |
Change a couple of the Parser::Diag methods to return DiagnosticInfo
and let the clients push whatever they want into the DiagnosticInfo
instead of hard coding a few forms. Also switch various clients to
use Diag(Tok, ...) instead of Diag(Tok.getLocation(), ...) as the
canonical form to simplify the code a bit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59509 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseExprCXX.cpp')
-rw-r--r-- | lib/Parse/ParseExprCXX.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index 19b521b264..006c79158a 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -198,17 +198,13 @@ Parser::ExprResult Parser::ParseCXXCasts() { TypeTy *CastTy = ParseTypeName(); SourceLocation RAngleBracketLoc = Tok.getLocation(); - if (ExpectAndConsume(tok::greater, diag::err_expected_greater)) { - Diag(LAngleBracketLoc, diag::err_matching, "<"); - return ExprResult(true); - } + if (ExpectAndConsume(tok::greater, diag::err_expected_greater)) + return Diag(LAngleBracketLoc, diag::err_matching) << "<"; SourceLocation LParenLoc = Tok.getLocation(), RParenLoc; - if (Tok.isNot(tok::l_paren)) { - Diag(Tok, diag::err_expected_lparen_after, CastName); - return ExprResult(true); - } + if (Tok.isNot(tok::l_paren)) + return Diag(Tok, diag::err_expected_lparen_after) << CastName; ExprResult Result = ParseSimpleParenExpression(RParenLoc); @@ -515,7 +511,7 @@ bool Parser::ParseCXXTypeSpecifierSeq(DeclSpec &DS) { // Parse one or more of the type specifiers. if (!MaybeParseTypeSpecifier(DS, isInvalid, PrevSpec)) { - Diag(Tok.getLocation(), diag::err_operator_missing_type_specifier); + Diag(Tok, diag::err_operator_missing_type_specifier); return true; } while (MaybeParseTypeSpecifier(DS, isInvalid, PrevSpec)) ; |