]> granicus.if.org Git - clang/commitdiff
Fix location processing of @selector: the range should include the @ sign.
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 16 Oct 2007 23:21:02 +0000 (23:21 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 16 Oct 2007 23:21:02 +0000 (23:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43051 91177308-0d34-0410-b5e6-96231b3b80d8

Parse/ParseObjc.cpp
Sema/Sema.h
Sema/SemaExpr.cpp
clang.xcodeproj/project.pbxproj
include/clang/AST/Expr.h
include/clang/Parse/Action.h
include/clang/Parse/Parser.h

index 4579650085fe228c0b774aec242705fed9ace1c6..0b6f303a4890d07d529204a6d3f4a77fda848fb2 100644 (file)
@@ -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
index 5d36aced05d67ffe1874e8ab7d9148891a0f313e..bb5d07fd6d79ae025bd16ec2ff2b2d802a374d3d 100644 (file)
@@ -448,6 +448,7 @@ public:
   // ParseObjCSelectorExpression - Build selector expression for @selector
   virtual ExprResult ParseObjCSelectorExpression(Selector Sel,
                                                  SourceLocation AtLoc,
+                                                 SourceLocation SelLoc,
                                                  SourceLocation LParenLoc,
                                                  SourceLocation RParenLoc);
   
index e016cbb36863d1e973011469318eeb38f41e3cdd..a6a47adddbcccaa127715f7e1cac638d9d42815e 100644 (file)
@@ -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);
index b88c381faa0b21298a15082c3f3667bb0e3dacc7..75d938806b0068e9faf478a9935977559b88f772 100644 (file)
                08FB7793FE84155DC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
+                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
                        projectDirPath = "";
index 1b932deedcc4b287d57f844b8e80f970d17bfc11..64e47b4fe07532ace206b3f25d4141b449a3c299 100644 (file)
@@ -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;
   }
index faadf17945d9d71d19b434ee670491ad1ede78e8..d68850582fd8ed6ec1a3905c5ceb2f9609e7a51e 100644 (file)
@@ -596,6 +596,7 @@ public:
   }
   
   virtual ExprResult ParseObjCSelectorExpression(Selector Sel,
+                                                 SourceLocation AtLoc,
                                                  SourceLocation SelLoc,
                                                  SourceLocation LParenLoc,
                                                  SourceLocation RParenLoc) {
index bc249bb4df34cc8a399d056fdbdc7a42fc3e7d8a..8c0b8e47bf2237c54e0ac50bcccf8ccc81713ef8 100644 (file)
@@ -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();
 
   //===--------------------------------------------------------------------===//