[cfe-commits] r64560 - in /cfe/trunk: include/clang/Parse/Action.h lib/Parse/ParseObjc.cpp lib/Sema/Sema.h lib/Sema/SemaExprObjC.cpp

Anders Carlsson andersca at mac.com
Sat Feb 14 10:21:46 PST 2009


Author: andersca
Date: Sat Feb 14 12:21:46 2009
New Revision: 64560

URL: http://llvm.org/viewvc/llvm-project?rev=64560&view=rev
Log:
Pass the location of the start of the selector to ActOnClassMessage/ActOnInstanceMessage.

Modified:
    cfe/trunk/include/clang/Parse/Action.h
    cfe/trunk/lib/Parse/ParseObjc.cpp
    cfe/trunk/lib/Sema/Sema.h
    cfe/trunk/lib/Sema/SemaExprObjC.cpp

Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=64560&r1=64559&r2=64560&view=diff

==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Sat Feb 14 12:21:46 2009
@@ -1292,8 +1292,8 @@
     Scope *S,
     IdentifierInfo *receivingClassName, 
     Selector Sel,
-    SourceLocation lbrac,
-    SourceLocation receiverLoc,
+    SourceLocation lbrac, SourceLocation receiverLoc,
+    SourceLocation selectorLoc,
     SourceLocation rbrac, 
     ExprTy **ArgExprs, unsigned NumArgs) {
     return 0;
@@ -1303,7 +1303,7 @@
   // is obtained from NumArgs.
   virtual ExprResult ActOnInstanceMessage(
     ExprTy *receiver, Selector Sel,
-    SourceLocation lbrac, SourceLocation rbrac, 
+    SourceLocation lbrac, SourceLocation selectorLoc, SourceLocation rbrac, 
     ExprTy **ArgExprs, unsigned NumArgs) {
     return 0;
   }

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=64560&r1=64559&r2=64560&view=diff

==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Sat Feb 14 12:21:46 2009
@@ -1491,6 +1491,8 @@
   SourceLocation Loc;
   IdentifierInfo *selIdent = ParseObjCSelector(Loc);
 
+  SourceLocation SelectorLoc = Loc;
+    
   llvm::SmallVector<IdentifierInfo *, 12> KeyIdents;
   ExprVector KeyExprs(Actions);
 
@@ -1573,10 +1575,11 @@
   // We've just parsed a keyword message.
   if (ReceiverName)
     return Owned(Actions.ActOnClassMessage(CurScope, ReceiverName, Sel,
-                                           LBracLoc, NameLoc, RBracLoc,
+                                           LBracLoc, NameLoc, SelectorLoc, 
+                                           RBracLoc,
                                            KeyExprs.take(), KeyExprs.size()));
   return Owned(Actions.ActOnInstanceMessage(ReceiverExpr.release(), Sel,
-                                            LBracLoc, RBracLoc,
+                                            LBracLoc, SelectorLoc, RBracLoc,
                                             KeyExprs.take(), KeyExprs.size()));
 }
 

Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=64560&r1=64559&r2=64560&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Sat Feb 14 12:21:46 2009
@@ -1667,8 +1667,8 @@
   // is obtained from NumArgs.
   virtual ExprResult ActOnClassMessage(
     Scope *S,
-    IdentifierInfo *receivingClassName, Selector Sel,
-    SourceLocation lbrac, SourceLocation receiverLoc, SourceLocation rbrac, 
+    IdentifierInfo *receivingClassName, Selector Sel, SourceLocation lbrac, 
+    SourceLocation receiverLoc, SourceLocation selectorLoc,SourceLocation rbrac, 
     ExprTy **ArgExprs, unsigned NumArgs);
 
   // ActOnInstanceMessage - used for both unary and keyword messages.
@@ -1676,7 +1676,7 @@
   // is obtained from NumArgs.
   virtual ExprResult ActOnInstanceMessage(
     ExprTy *receiver, Selector Sel,
-    SourceLocation lbrac, SourceLocation rbrac, 
+    SourceLocation lbrac, SourceLocation receiverLoc, SourceLocation rbrac, 
     ExprTy **ArgExprs, unsigned NumArgs);
   
   /// ActOnPragmaPack - Called on well formed #pragma pack(...).

Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=64560&r1=64559&r2=64560&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Sat Feb 14 12:21:46 2009
@@ -177,7 +177,8 @@
 Sema::ExprResult Sema::ActOnClassMessage(
   Scope *S,
   IdentifierInfo *receiverName, Selector Sel,
-  SourceLocation lbrac, SourceLocation receiverLoc, SourceLocation rbrac, 
+  SourceLocation lbrac, SourceLocation receiverLoc,
+  SourceLocation selectorLoc, SourceLocation rbrac, 
   ExprTy **Args, unsigned NumArgs)
 {
   assert(receiverName && "missing receiver class name");
@@ -202,8 +203,8 @@
         ExprResult ReceiverExpr = new (Context) ObjCSuperExpr(SourceLocation(),
                                                               superTy);
         // We are really in an instance method, redirect.
-        return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac, rbrac,
-                                    Args, NumArgs);
+        return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac, 
+                                    selectorLoc, rbrac, Args, NumArgs);
       }
       // We are sending a message to 'super' within a class method. Do nothing,
       // the receiver will pass through as 'super' (how convenient:-).
@@ -216,8 +217,8 @@
         ExprResult ReceiverExpr = new (Context) DeclRefExpr(VD, VD->getType(), 
                                                             receiverLoc);
         // We are really in an instance method, redirect.
-        return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac, rbrac,
-                                    Args, NumArgs);
+        return ActOnInstanceMessage(ReceiverExpr.get(), Sel, lbrac, 
+                                    selectorLoc, rbrac, Args, NumArgs);
       }
       return Diag(receiverLoc, diag::err_undeclared_var_use) << receiverName;
     }      
@@ -290,6 +291,7 @@
 // is obtained from Sel.getNumArgs().
 Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel,
                                             SourceLocation lbrac, 
+                                            SourceLocation receiverLoc,
                                             SourceLocation rbrac,
                                             ExprTy **Args, unsigned NumArgs) {
   assert(receiver && "missing receiver expression");
@@ -310,6 +312,7 @@
         if (ObjCInterfaceDecl *SuperDecl = ClassDecl->getSuperClass())
           Method = SuperDecl->lookupInstanceMethod(Sel);
     }
+
     if (CheckMessageArgumentTypes(ArgExprs, NumArgs, Sel, Method, false,
                                   lbrac, rbrac, returnType))
       return true;





More information about the cfe-commits mailing list