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

Douglas Gregor dgregor at apple.com
Tue Nov 17 15:31:37 PST 2009


Author: dgregor
Date: Tue Nov 17 17:31:36 2009
New Revision: 89164

URL: http://llvm.org/viewvc/llvm-project?rev=89164&view=rev
Log:
Rename Objective-C message send completion functions to indicate that we're referring to message sends

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

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

==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Tue Nov 17 17:31:36 2009
@@ -2328,25 +2328,27 @@
   /// \param S the scope in which the operator keyword occurs.  
   virtual void CodeCompleteObjCProperty(Scope *S, ObjCDeclSpec &ODS) { }
   
-  /// \brief Code completion for an ObjC factory method (from within a message 
-  /// expression).
+  /// \brief Code completion for an ObjC message expression that refers to
+  /// a class method.
   ///
   /// This code completion action is invoked when the code-completion token is
   /// found after the class name.
   ///
   /// \param S the scope in which the message expression occurs. 
   /// \param FName the factory name. 
-  virtual void CodeCompleteObjCFactoryMethod(Scope *S, IdentifierInfo *FName){ }
+  /// \param FNameLoc the source location of the factory name.
+  virtual void CodeCompleteObjCClassMessage(Scope *S, IdentifierInfo *FName,
+                                            SourceLocation FNameLoc){ }
   
-  /// \brief Code completion for an ObjC instance method (from within a message 
-  /// expression).
+  /// \brief Code completion for an ObjC message expression that refers to
+  /// an instance method.
   ///
   /// This code completion action is invoked when the code-completion token is
   /// found after the receiver expression.
   ///
   /// \param S the scope in which the operator keyword occurs.  
   /// \param Receiver an expression for the receiver of the message. 
-  virtual void CodeCompleteObjCInstanceMethod(Scope *S, ExprTy *Receiver) { }
+  virtual void CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver) { }
   //@}
 };
 

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

==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Tue Nov 17 17:31:36 2009
@@ -1569,9 +1569,9 @@
                                        ExprArg ReceiverExpr) {
   if (Tok.is(tok::code_completion)) {
     if (ReceiverName)
-      Actions.CodeCompleteObjCFactoryMethod(CurScope, ReceiverName);
+      Actions.CodeCompleteObjCClassMessage(CurScope, ReceiverName, NameLoc);
     else
-      Actions.CodeCompleteObjCInstanceMethod(CurScope, ReceiverExpr.release());
+      Actions.CodeCompleteObjCInstanceMessage(CurScope, ReceiverExpr.get());
     ConsumeToken();
   }
   // Parse objc-selector

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

==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Tue Nov 17 17:31:36 2009
@@ -4003,8 +4003,9 @@
   virtual void CodeCompleteOperatorName(Scope *S);
   
   virtual void CodeCompleteObjCProperty(Scope *S, ObjCDeclSpec &ODS);
-  virtual void CodeCompleteObjCFactoryMethod(Scope *S, IdentifierInfo *FName);
-  virtual void CodeCompleteObjCInstanceMethod(Scope *S, ExprTy *Receiver);
+  virtual void CodeCompleteObjCClassMessage(Scope *S, IdentifierInfo *FName,
+                                            SourceLocation FNameLoc);
+  virtual void CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver);
   //@}
   
   //===--------------------------------------------------------------------===//

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

==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Tue Nov 17 17:31:36 2009
@@ -1624,13 +1624,11 @@
     AddObjCMethods(Impl, WantInstanceMethods, CurContext, Results);
 }
 
-void Sema::CodeCompleteObjCFactoryMethod(Scope *S, IdentifierInfo *FName) {
+void Sema::CodeCompleteObjCClassMessage(Scope *S, IdentifierInfo *FName,
+                                        SourceLocation FNameLoc) {
   typedef CodeCompleteConsumer::Result Result;
   ObjCInterfaceDecl *CDecl = 0;
 
-  // FIXME: Pass this in!
-  SourceLocation NameLoc;
-
   if (FName->isStr("super")) {
     // We're sending a message to "super".
     if (ObjCMethodDecl *CurMethod = getCurMethodDecl()) {
@@ -1652,8 +1650,8 @@
         QualType SuperTy = Context.getObjCInterfaceType(CDecl);
         SuperTy = Context.getObjCObjectPointerType(SuperTy);
         OwningExprResult Super
-          = Owned(new (Context) ObjCSuperExpr(NameLoc, SuperTy));
-        return CodeCompleteObjCInstanceMethod(S, (Expr *)Super.get());
+          = Owned(new (Context) ObjCSuperExpr(FNameLoc, SuperTy));
+        return CodeCompleteObjCInstanceMessage(S, (Expr *)Super.get());
       }
 
       // Okay, we're calling a factory method in our superclass.
@@ -1663,7 +1661,7 @@
   // If the given name refers to an interface type, retrieve the
   // corresponding declaration.
   if (!CDecl)
-    if (TypeTy *Ty = getTypeName(*FName, NameLoc, S, 0, false)) {
+    if (TypeTy *Ty = getTypeName(*FName, FNameLoc, S, 0, false)) {
       QualType T = GetTypeFromParser(Ty, 0);
       if (!T.isNull()) 
         if (const ObjCInterfaceType *Interface = T->getAs<ObjCInterfaceType>())
@@ -1673,9 +1671,9 @@
   if (!CDecl && FName->isStr("super")) {
     // "super" may be the name of a variable, in which case we are
     // probably calling an instance method.
-    OwningExprResult Super = ActOnDeclarationNameExpr(S, NameLoc, FName,
+    OwningExprResult Super = ActOnDeclarationNameExpr(S, FNameLoc, FName,
                                                       false, 0, false);
-    return CodeCompleteObjCInstanceMethod(S, (Expr *)Super.get());
+    return CodeCompleteObjCInstanceMessage(S, (Expr *)Super.get());
   }
 
   // Add all of the factory methods in this Objective-C class, its protocols,
@@ -1689,7 +1687,7 @@
   HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
 }
 
-void Sema::CodeCompleteObjCInstanceMethod(Scope *S, ExprTy *Receiver) {
+void Sema::CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver) {
   typedef CodeCompleteConsumer::Result Result;
   
   Expr *RecExpr = static_cast<Expr *>(Receiver);





More information about the cfe-commits mailing list