]> granicus.if.org Git - clang/commitdiff
Extend bracket insertion to handle nullary selectors, e.g.
authorDouglas Gregor <dgregor@apple.com>
Wed, 15 Sep 2010 14:54:45 +0000 (14:54 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 15 Sep 2010 14:54:45 +0000 (14:54 +0000)
  a getFoo]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113969 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseExpr.cpp
test/FixIt/fixit-objc-message.m

index 1f5a6964e3898d40168236563d25655b7b99c2a1..e466af2d614757eeb98036e2835aa5aefb258534 100644 (file)
@@ -984,7 +984,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) {
       // message send, then this is probably a message send with a missing
       // opening bracket '['.
       if (getLang().ObjC1 && !InMessageExpression && 
-          NextToken().is(tok::colon)) {
+          (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) {
         LHS = ParseObjCMessageExpressionBody(SourceLocation(), SourceLocation(),
                                              ParsedType(), LHS.get());
         break;
index 0eaa7f05471618138408580b0ff08e969de695fe..f19b489f997ba03ed041d06eefdc0c363a49b7d7 100644 (file)
 @interface A
 - (int)method1:(int)x second:(float)y;
 + (int)method2:(int)x second:(double)y;
+- (int)getBlah;
 @end
 
 void f(A *a, int i, int j) {
   a method1:5+2 second:+(3.14159)];
   a method1:[a method1:3 second:j] second:i++]
+  a getBlah];
 }