[cfe-commits] r113969 - in /cfe/trunk: lib/Parse/ParseExpr.cpp test/FixIt/fixit-objc-message.m

Douglas Gregor dgregor at apple.com
Wed Sep 15 07:54:45 PDT 2010


Author: dgregor
Date: Wed Sep 15 09:54:45 2010
New Revision: 113969

URL: http://llvm.org/viewvc/llvm-project?rev=113969&view=rev
Log:
Extend bracket insertion to handle nullary selectors, e.g.

  a getFoo]



Modified:
    cfe/trunk/lib/Parse/ParseExpr.cpp
    cfe/trunk/test/FixIt/fixit-objc-message.m

Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=113969&r1=113968&r2=113969&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Wed Sep 15 09:54:45 2010
@@ -984,7 +984,7 @@
       // 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;

Modified: cfe/trunk/test/FixIt/fixit-objc-message.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit-objc-message.m?rev=113969&r1=113968&r2=113969&view=diff
==============================================================================
--- cfe/trunk/test/FixIt/fixit-objc-message.m (original)
+++ cfe/trunk/test/FixIt/fixit-objc-message.m Wed Sep 15 09:54:45 2010
@@ -11,9 +11,11 @@
 @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];
 }





More information about the cfe-commits mailing list