summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExprCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-11-17 16:14:12 +0000
committerDouglas Gregor <dgregor@apple.com>2008-11-17 16:14:12 +0000
commitd69246bd5badd17babae14aa202caaf2152dd3d5 (patch)
tree05bd4162a176f10702cb1d6bc5c082a4631e0885 /clang/lib/Parse/ParseExprCXX.cpp
parent9edcc802c3ad481e730fe6caa0ddf737e04d058e (diff)
downloadbcm5719-llvm-d69246bd5badd17babae14aa202caaf2152dd3d5.tar.gz
bcm5719-llvm-d69246bd5badd17babae14aa202caaf2152dd3d5.zip
Some cleanups for C++ operator overloading
llvm-svn: 59443
Diffstat (limited to 'clang/lib/Parse/ParseExprCXX.cpp')
-rw-r--r--clang/lib/Parse/ParseExprCXX.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index 692e35df93d..8f14ce50b8d 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -149,7 +149,7 @@ Parser::ExprResult Parser::ParseCXXIdExpression() {
case tok::kw_operator: {
SourceLocation OperatorLoc = Tok.getLocation();
- if (IdentifierInfo *II = MaybeParseOperatorFunctionId()) {
+ if (IdentifierInfo *II = TryParseOperatorFunctionId()) {
return Actions.ActOnIdentifierExpr(CurScope, OperatorLoc, *II,
Tok.is(tok::l_paren), &SS);
}
@@ -519,7 +519,7 @@ bool Parser::ParseCXXTypeSpecifierSeq(DeclSpec &DS) {
return false;
}
-/// MaybeParseOperatorFunctionId - Attempts to parse a C++ overloaded
+/// TryParseOperatorFunctionId - Attempts to parse a C++ overloaded
/// operator name (C++ [over.oper]). If successful, returns the
/// predefined identifier that corresponds to that overloaded
/// operator. Otherwise, returns NULL and does not consume any tokens.
@@ -534,7 +534,7 @@ bool Parser::ParseCXXTypeSpecifierSeq(DeclSpec &DS) {
/// ^= &= |= << >> >>= <<= == !=
/// <= >= && || ++ -- , ->* ->
/// () []
-IdentifierInfo *Parser::MaybeParseOperatorFunctionId() {
+IdentifierInfo *Parser::TryParseOperatorFunctionId() {
assert(Tok.is(tok::kw_operator) && "Expected 'operator' keyword");
OverloadedOperatorKind Op = OO_None;
@@ -581,16 +581,12 @@ IdentifierInfo *Parser::MaybeParseOperatorFunctionId() {
return &PP.getIdentifierTable().getOverloadedOperator(OO_Subscript);
default:
- break;
- }
-
- if (Op == OO_None)
return 0;
- else {
- ConsumeToken(); // 'operator'
- ConsumeAnyToken(); // the operator itself
- return &PP.getIdentifierTable().getOverloadedOperator(Op);
}
+
+ ConsumeToken(); // 'operator'
+ ConsumeAnyToken(); // the operator itself
+ return &PP.getIdentifierTable().getOverloadedOperator(Op);
}
/// ParseConversionFunctionId - Parse a C++ conversion-function-id,
OpenPOWER on IntegriCloud