summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExpr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-15 15:09:43 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-15 15:09:43 +0000
commit7617c7d2951f4cffb2de4dd4addbbf8884b6a2aa (patch)
tree01490f0360654b2a52fbb0706924e7781f32468f /clang/lib/Parse/ParseExpr.cpp
parent851b32386620aed60aa52ea411e054289f14908d (diff)
downloadbcm5719-llvm-7617c7d2951f4cffb2de4dd4addbbf8884b6a2aa.tar.gz
bcm5719-llvm-7617c7d2951f4cffb2de4dd4addbbf8884b6a2aa.zip
Extend bracket insertion to message sends to "super", e.g.,
super method:arg] will now recover nicely and insert the '[' before 'super'. llvm-svn: 113971
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
-rw-r--r--clang/lib/Parse/ParseExpr.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp
index e466af2d614..0f9154827e9 100644
--- a/clang/lib/Parse/ParseExpr.cpp
+++ b/clang/lib/Parse/ParseExpr.cpp
@@ -663,6 +663,18 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
break;
}
+ // In an Objective-C method, if we have "super" followed by an identifier,
+ // the token sequence is ill-fomed. However, if there's a ':' or ']' after
+ // that identifier, this is probably a message send with a missing open
+ // bracket. Treat it as such.
+ if (getLang().ObjC1 && &II == Ident_super && Tok.is(tok::identifier) &&
+ getCurScope()->isInObjcMethodScope() &&
+ (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) {
+ Res = ParseObjCMessageExpressionBody(SourceLocation(), ILoc, ParsedType(),
+ 0);
+ break;
+ }
+
// Make sure to pass down the right value for isAddressOfOperand.
if (isAddressOfOperand && isPostfixExpressionSuffixStart())
isAddressOfOperand = false;
OpenPOWER on IntegriCloud