diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-02-15 19:17:31 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-02-15 19:17:31 +0000 |
commit | d39ae3eec823ba9fd2dfeba325a092ff98d8fd23 (patch) | |
tree | b6ba196ee4499a98282d1716072c20156e5634ce /clang/lib/Parse/ParseExpr.cpp | |
parent | 09948f1af6304cfab8bfd6949236ca79d8d01a0a (diff) | |
download | bcm5719-llvm-d39ae3eec823ba9fd2dfeba325a092ff98d8fd23.tar.gz bcm5719-llvm-d39ae3eec823ba9fd2dfeba325a092ff98d8fd23.zip |
When we encounter an Objective-C class name in an expression, followed
by the code completion token, treat this as a class message send where
the opening square bracket is missing. Fixes <rdar://problem/6970911>.
llvm-svn: 125587
Diffstat (limited to 'clang/lib/Parse/ParseExpr.cpp')
-rw-r--r-- | clang/lib/Parse/ParseExpr.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index 55d2ba222f5..4113c4fac25 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -669,12 +669,17 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, break; } - // If we have an Objective-C class name followed by an identifier and - // either ':' or ']', this is an Objective-C class message send that's - // missing the opening '['. Recovery appropriately. - if (getLang().ObjC1 && Tok.is(tok::identifier) && !InMessageExpression) { + // If we have an Objective-C class name followed by an identifier + // and either ':' or ']', this is an Objective-C class message + // send that's missing the opening '['. Recovery + // appropriately. Also take this path if we're performing code + // completion after an Objective-C class name. + if (getLang().ObjC1 && + ((Tok.is(tok::identifier) && !InMessageExpression) || + Tok.is(tok::code_completion))) { const Token& Next = NextToken(); - if (Next.is(tok::colon) || Next.is(tok::r_square)) + if (Tok.is(tok::code_completion) || + Next.is(tok::colon) || Next.is(tok::r_square)) if (ParsedType Typ = Actions.getTypeName(II, ILoc, getCurScope())) if (Typ.get()->isObjCObjectOrInterfaceType()) { // Fake up a Declarator to use with ActOnTypeName. |