diff options
author | Chris Lattner <sabre@nondot.org> | 2010-05-31 18:18:22 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-05-31 18:18:22 +0000 |
commit | c59cb38810c63a806270385f79ea84e0203754ea (patch) | |
tree | 610b846d11888eb4365f2b4eef33c91915508bc8 /lib/Parse/ParseObjc.cpp | |
parent | 61ecf35dcb18f53ea4b41ce9b8152f8046616be6 (diff) |
Minor tweaks on doug's objc recovery patch: the caller
of isSimpleObjCMessageExpression checks the language,
so change a dynamic check into an assert.
isSimpleObjCMessageExpression is expensive, so only do it
in the common case when it is likely to matter: when the [
of the postfix expr starts on a new line. This should avoid
doing lookahead for every array expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105229 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index 34b8187be5..365733d8c4 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -1730,7 +1730,6 @@ Parser::OwningExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) { /// expression /// simple-type-specifier /// typename-specifier - bool Parser::ParseObjCXXMessageReceiver(bool &IsExpr, void *&TypeOrExpr) { if (Tok.is(tok::identifier) || Tok.is(tok::coloncolon) || Tok.is(tok::kw_typename) || Tok.is(tok::annot_cxxscope)) @@ -1800,11 +1799,8 @@ bool Parser::ParseObjCXXMessageReceiver(bool &IsExpr, void *&TypeOrExpr) { /// This routine will only return true for a subset of valid message-send /// expressions. bool Parser::isSimpleObjCMessageExpression() { - assert(Tok.is(tok::l_square) && + assert(Tok.is(tok::l_square) && getLang().ObjC1 && "Incorrect start for isSimpleObjCMessageExpression"); - if (!getLang().ObjC1) - return false; - return GetLookAheadToken(1).is(tok::identifier) && GetLookAheadToken(2).is(tok::identifier); } @@ -1855,7 +1851,9 @@ Parser::OwningExprResult Parser::ParseObjCMessageExpression() { return ParseObjCMessageExpressionBody(LBracLoc, SourceLocation(), TypeOrExpr, ExprArg(Actions)); - } else if (Tok.is(tok::identifier)) { + } + + if (Tok.is(tok::identifier)) { IdentifierInfo *Name = Tok.getIdentifierInfo(); SourceLocation NameLoc = Tok.getLocation(); TypeTy *ReceiverType; |