aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-10-15 20:55:58 +0000
committerSteve Naroff <snaroff@apple.com>2007-10-15 20:55:58 +0000
commita642beb9f143130588dcf622f5f7020832b22707 (patch)
tree917abdbd8a32f7c7b3a5313d638ea2e622fd590e
parentec0550fa3653d46560bf4484a2e988329c228e39 (diff)
Fix a parser bug with message expressions - need to call ParsePostfixExpressionSuffix().
Now were correctly allow the following... i = [str rangeOfString:@"]"].length; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43012 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Parse/ParseExpr.cpp7
-rw-r--r--Parse/ParseObjc.cpp2
-rw-r--r--include/clang/Parse/Parser.h2
3 files changed, 6 insertions, 5 deletions
diff --git a/Parse/ParseExpr.cpp b/Parse/ParseExpr.cpp
index c69d4d2d95..2bc1d62fcf 100644
--- a/Parse/ParseExpr.cpp
+++ b/Parse/ParseExpr.cpp
@@ -178,7 +178,7 @@ Parser::ExprResult Parser::ParseExpression() {
/// for example, @encode-expression.
///
Parser::ExprResult Parser::ParseExpressionWithLeadingAt(SourceLocation AtLoc) {
- ExprResult LHS = ParseObjCExpression(AtLoc);
+ ExprResult LHS = ParseObjCAtExpression(AtLoc);
if (LHS.isInvalid) return LHS;
return ParseRHSOfBinaryExpression(LHS, prec::Comma);
@@ -601,10 +601,11 @@ Parser::ExprResult Parser::ParseCastExpression(bool isUnaryExpression) {
return ParseCXXCasts();
case tok::at: {
SourceLocation AtLoc = ConsumeToken();
- return ParseObjCExpression(AtLoc);
+ return ParseObjCAtExpression(AtLoc);
}
case tok::l_square:
- return ParseObjCMessageExpression();
+ // These can be followed by postfix-expr pieces.
+ return ParsePostfixExpressionSuffix(ParseObjCMessageExpression());
default:
Diag(Tok, diag::err_expected_expression);
return ExprResult(true);
diff --git a/Parse/ParseObjc.cpp b/Parse/ParseObjc.cpp
index 4236314fdf..85559019e0 100644
--- a/Parse/ParseObjc.cpp
+++ b/Parse/ParseObjc.cpp
@@ -1114,7 +1114,7 @@ void Parser::ParseObjCClassMethodDefinition() {
StmtResult FnBody = ParseCompoundStatementBody();
}
-Parser::ExprResult Parser::ParseObjCExpression(SourceLocation AtLoc) {
+Parser::ExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) {
switch (Tok.getKind()) {
case tok::string_literal: // primary-expression: string-literal
diff --git a/include/clang/Parse/Parser.h b/include/clang/Parse/Parser.h
index 5e4c5290e8..66ca274915 100644
--- a/include/clang/Parse/Parser.h
+++ b/include/clang/Parse/Parser.h
@@ -360,7 +360,7 @@ private:
//===--------------------------------------------------------------------===//
// Objective-C Expressions
- ExprResult ParseObjCExpression(SourceLocation AtLocation);
+ ExprResult ParseObjCAtExpression(SourceLocation AtLocation);
ExprResult ParseObjCStringLiteral();
ExprResult ParseObjCEncodeExpression();
ExprResult ParseObjCProtocolExpression();