diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-05-31 14:40:22 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-05-31 14:40:22 +0000 |
| commit | 990ccace5b4d2fea1205100d00b60a1c8fc329e9 (patch) | |
| tree | c261c19cbbcaa50a9e37a72dfc9a6588ee1a9892 /clang/lib/Parse/ParseExpr.cpp | |
| parent | 5ac57e3440b0d501450198257a291aac53fa4946 (diff) | |
| download | bcm5719-llvm-990ccace5b4d2fea1205100d00b60a1c8fc329e9.tar.gz bcm5719-llvm-990ccace5b4d2fea1205100d00b60a1c8fc329e9.zip | |
When we see the a '[' in a postfix expression in Objective-C, perform
a simple, quick check to determine whether the expression starting
with '[' can only be an Objective-C message send. If so, don't parse
it as an array subscript expression. This improves recovery for, e.g.,
[a method1]
[a method2]
so that we now produce
t.m:10:13: error: expected ';' after expression
[a method]
^
instead of some mess about expecting ']'.
llvm-svn: 105221
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
| -rw-r--r-- | clang/lib/Parse/ParseExpr.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 8fb71c3ff64..093f9738ca9 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -961,6 +961,9 @@ Parser::ParsePostfixExpressionSuffix(OwningExprResult LHS) { default: // Not a postfix-expression suffix. return move(LHS); case tok::l_square: { // postfix-expression: p-e '[' expression ']' + if (getLang().ObjC1 && isSimpleObjCMessageExpression()) + return move(LHS); + Loc = ConsumeBracket(); OwningExprResult Idx(ParseExpression()); |

