summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseObjc.cpp
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2013-12-30 23:29:50 +0000
committerAlp Toker <alp@nuanti.com>2013-12-30 23:29:50 +0000
commit35d8703dbe89f717ef6c71b35e4b29aa51bbd7a7 (patch)
treeba2f4d9bc887ce0cb2af74b86fed4c36fb610400 /clang/lib/Parse/ParseObjc.cpp
parentbb79c338edc0abd2260ba7fdcb2d60ab16e473e4 (diff)
downloadbcm5719-llvm-35d8703dbe89f717ef6c71b35e4b29aa51bbd7a7.tar.gz
bcm5719-llvm-35d8703dbe89f717ef6c71b35e4b29aa51bbd7a7.zip
Switch over more of the parser to err_expected
Includes a fix for a missing highlight range caused by a ',' typo in the PP diagnostics. llvm-svn: 198252
Diffstat (limited to 'clang/lib/Parse/ParseObjc.cpp')
-rw-r--r--clang/lib/Parse/ParseObjc.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 6f83707d05b..a36d2ea1b41 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -1058,7 +1058,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc,
// Each iteration parses a single keyword argument.
if (Tok.isNot(tok::colon)) {
- Diag(Tok, diag::err_expected_colon);
+ Diag(Tok, diag::err_expected) << tok::colon;
break;
}
ConsumeToken(); // Eat the ':'.
@@ -2486,7 +2486,7 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
KeyLocs.push_back(Loc);
if (Tok.isNot(tok::colon)) {
- Diag(Tok, diag::err_expected_colon);
+ Diag(Tok, diag::err_expected) << tok::colon;
// We must manually skip to a ']', otherwise the expression skipper will
// stop at the ']' when it skips to the ';'. We want it to skip beyond
// the enclosing expression.
@@ -2589,10 +2589,8 @@ Parser::ParseObjCMessageExpressionBody(SourceLocation LBracLoc,
}
if (Tok.isNot(tok::r_square)) {
- if (Tok.is(tok::identifier))
- Diag(Tok, diag::err_expected_colon);
- else
- Diag(Tok, diag::err_expected_rsquare);
+ Diag(Tok, diag::err_expected)
+ << (Tok.is(tok::identifier) ? tok::colon : tok::r_square);
// We must manually skip to a ']', otherwise the expression skipper will
// stop at the ']' when it skips to the ';'. We want it to skip beyond
// the enclosing expression.
@@ -2886,7 +2884,7 @@ ExprResult Parser::ParseObjCSelectorExpression(SourceLocation AtLoc) {
++nColons;
KeyIdents.push_back(0);
} else if (Tok.isNot(tok::colon))
- return ExprError(Diag(Tok, diag::err_expected_colon));
+ return ExprError(Diag(Tok, diag::err_expected) << tok::colon);
++nColons;
ConsumeToken(); // Eat the ':' or '::'.
OpenPOWER on IntegriCloud