Assert that Parser::MaybeParseOperatorFunctionId is called when token is kw_operator, and replace ExpectAndConsume for the 'operator' token with a ConsumeToken.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58855 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index fcb229b..3134ff8 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -308,8 +308,7 @@
/// <= >= && || ++ -- , ->* ->
/// () []
IdentifierInfo *Parser::MaybeParseOperatorFunctionId() {
- if (Tok.isNot(tok::kw_operator))
- return 0;
+ assert(Tok.is(tok::kw_operator) && "Expected 'operator' keyword");
OverloadedOperatorKind Op = OO_None;
switch (NextToken().getKind()) {
@@ -361,7 +360,7 @@
if (Op == OO_None)
return 0;
else {
- ExpectAndConsume(tok::kw_operator, diag::err_expected_operator);
+ ConsumeToken(); // 'operator'
ConsumeAnyToken(); // the operator itself
return &PP.getIdentifierTable().getOverloadedOperator(Op);
}