Extend bracket insertion to handle nullary selectors, e.g.
a getFoo]
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113969 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 1f5a696..e466af2 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -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;
diff --git a/test/FixIt/fixit-objc-message.m b/test/FixIt/fixit-objc-message.m
index 0eaa7f0..f19b489 100644
--- a/test/FixIt/fixit-objc-message.m
+++ b/test/FixIt/fixit-objc-message.m
@@ -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];
}