diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2007-10-16 23:21:02 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2007-10-16 23:21:02 +0000 |
| commit | 6bd1d612ac0c6fbb8af43f6f1be333b798c467b6 (patch) | |
| tree | 79bd0276d93bdd38d9e0d27713daf63a5144fa82 | |
| parent | 077c83bddbca04d0d240a83083af059cb20f986c (diff) | |
| download | bcm5719-llvm-6bd1d612ac0c6fbb8af43f6f1be333b798c467b6.tar.gz bcm5719-llvm-6bd1d612ac0c6fbb8af43f6f1be333b798c467b6.zip | |
Fix location processing of @selector: the range should include the @ sign.
llvm-svn: 43051
| -rw-r--r-- | clang/Parse/ParseObjc.cpp | 10 | ||||
| -rw-r--r-- | clang/Sema/Sema.h | 1 | ||||
| -rw-r--r-- | clang/Sema/SemaExpr.cpp | 1 | ||||
| -rw-r--r-- | clang/clang.xcodeproj/project.pbxproj | 1 | ||||
| -rw-r--r-- | clang/include/clang/AST/Expr.h | 12 | ||||
| -rw-r--r-- | clang/include/clang/Parse/Action.h | 1 | ||||
| -rw-r--r-- | clang/include/clang/Parse/Parser.h | 4 |
7 files changed, 18 insertions, 12 deletions
diff --git a/clang/Parse/ParseObjc.cpp b/clang/Parse/ParseObjc.cpp index 4579650085f..0b6f303a489 100644 --- a/clang/Parse/ParseObjc.cpp +++ b/clang/Parse/ParseObjc.cpp @@ -1128,9 +1128,9 @@ Parser::ExprResult Parser::ParseObjCAtExpression(SourceLocation AtLoc) { case tok::objc_encode: return ParsePostfixExpressionSuffix(ParseObjCEncodeExpression(AtLoc)); case tok::objc_protocol: - return ParsePostfixExpressionSuffix(ParseObjCProtocolExpression()); + return ParsePostfixExpressionSuffix(ParseObjCProtocolExpression(AtLoc)); case tok::objc_selector: - return ParsePostfixExpressionSuffix(ParseObjCSelectorExpression()); + return ParsePostfixExpressionSuffix(ParseObjCSelectorExpression(AtLoc)); default: Diag(AtLoc, diag::err_unexpected_at); SkipUntil(tok::semi); @@ -1282,7 +1282,7 @@ Parser::ExprResult Parser::ParseObjCEncodeExpression(SourceLocation AtLoc) { /// objc-protocol-expression /// @protocol ( protocol-name ) -Parser::ExprResult Parser::ParseObjCProtocolExpression() +Parser::ExprResult Parser::ParseObjCProtocolExpression(SourceLocation AtLoc) { SourceLocation ProtoLoc = ConsumeToken(); @@ -1309,7 +1309,7 @@ Parser::ExprResult Parser::ParseObjCProtocolExpression() /// objc-selector-expression /// @selector '(' objc-keyword-selector ')' -Parser::ExprResult Parser::ParseObjCSelectorExpression() +Parser::ExprResult Parser::ParseObjCSelectorExpression(SourceLocation AtLoc) { SourceLocation SelectorLoc = ConsumeToken(); @@ -1347,6 +1347,6 @@ Parser::ExprResult Parser::ParseObjCSelectorExpression() SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc); Selector Sel = PP.getSelectorTable().getSelector(KeyIdents.size(), &KeyIdents[0]); - return Actions.ParseObjCSelectorExpression(Sel, SelectorLoc, LParenLoc, + return Actions.ParseObjCSelectorExpression(Sel, AtLoc, SelectorLoc, LParenLoc, RParenLoc); }
\ No newline at end of file diff --git a/clang/Sema/Sema.h b/clang/Sema/Sema.h index 5d36aced05d..bb5d07fd6d7 100644 --- a/clang/Sema/Sema.h +++ b/clang/Sema/Sema.h @@ -448,6 +448,7 @@ public: // ParseObjCSelectorExpression - Build selector expression for @selector virtual ExprResult ParseObjCSelectorExpression(Selector Sel, SourceLocation AtLoc, + SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc); diff --git a/clang/Sema/SemaExpr.cpp b/clang/Sema/SemaExpr.cpp index e016cbb3686..a6a47adddbc 100644 --- a/clang/Sema/SemaExpr.cpp +++ b/clang/Sema/SemaExpr.cpp @@ -1922,6 +1922,7 @@ Sema::ExprResult Sema::ParseObjCEncodeExpression(SourceLocation AtLoc, Sema::ExprResult Sema::ParseObjCSelectorExpression(Selector Sel, SourceLocation AtLoc, + SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc) { QualType t = GetObjcSelType(AtLoc); diff --git a/clang/clang.xcodeproj/project.pbxproj b/clang/clang.xcodeproj/project.pbxproj index b88c381faa0..75d938806b0 100644 --- a/clang/clang.xcodeproj/project.pbxproj +++ b/clang/clang.xcodeproj/project.pbxproj @@ -742,6 +742,7 @@ 08FB7793FE84155DC02AAC07 /* Project object */ = { isa = PBXProject; buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */; + compatibilityVersion = "Xcode 2.4"; hasScannedForEncodings = 1; mainGroup = 08FB7794FE84155DC02AAC07 /* clang */; projectDirPath = ""; diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h index 1b932deedcc..64e47b4fe07 100644 --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -1099,21 +1099,23 @@ class ObjCSelectorExpr : public Expr { Selector SelName; - SourceLocation SelLoc, RParenLoc; + SourceLocation AtLoc, RParenLoc; public: ObjCSelectorExpr(QualType T, Selector selInfo, - SourceLocation selLoc, SourceLocation rp) + SourceLocation at, SourceLocation rp) : Expr(ObjCSelectorExprClass, T), SelName(selInfo), - SelLoc(selLoc), RParenLoc(rp) {} + AtLoc(at), RParenLoc(rp) {} const Selector &getSelector() const { return SelName; } Selector &getSelector() { return SelName; } + SourceLocation getAtLoc() const { return AtLoc; } + SourceLocation getRParenLoc() const { return RParenLoc; } + SourceRange getSourceRange() const { return SourceRange(AtLoc, RParenLoc); } + /// getNumArgs - Return the number of actual arguments to this call. unsigned getNumArgs() const { return SelName.getNumArgs(); } - SourceRange getSourceRange() const { return SourceRange(SelLoc, RParenLoc); } - static bool classof(const Stmt *T) { return T->getStmtClass() == ObjCSelectorExprClass; } diff --git a/clang/include/clang/Parse/Action.h b/clang/include/clang/Parse/Action.h index faadf17945d..d68850582fd 100644 --- a/clang/include/clang/Parse/Action.h +++ b/clang/include/clang/Parse/Action.h @@ -596,6 +596,7 @@ public: } virtual ExprResult ParseObjCSelectorExpression(Selector Sel, + SourceLocation AtLoc, SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc) { diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h index bc249bb4df3..8c0b8e47bf2 100644 --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -363,8 +363,8 @@ private: ExprResult ParseObjCAtExpression(SourceLocation AtLocation); ExprResult ParseObjCStringLiteral(); ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc); - ExprResult ParseObjCSelectorExpression(); - ExprResult ParseObjCProtocolExpression(); + ExprResult ParseObjCSelectorExpression(SourceLocation AtLoc); + ExprResult ParseObjCProtocolExpression(SourceLocation AtLoc); ExprResult ParseObjCMessageExpression(); //===--------------------------------------------------------------------===// |

