[cfe-commits] r116436 - in /cfe/trunk: include/clang/Sema/Sema.h lib/Sema/SemaCodeComplete.cpp

Douglas Gregor dgregor at apple.com
Wed Oct 13 14:24:53 PDT 2010


Author: dgregor
Date: Wed Oct 13 16:24:53 2010
New Revision: 116436

URL: http://llvm.org/viewvc/llvm-project?rev=116436&view=rev
Log:
Eliminate the use of ObjCSuperExpr in code completion.

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

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=116436&r1=116435&r2=116436&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Wed Oct 13 16:24:53 2010
@@ -4399,7 +4399,7 @@
                                        IdentifierInfo **SelIdents,
                                        unsigned NumSelIdents,
                                        bool AtArgumentExpression,
-                                       bool IsSuper = false);
+                                       ObjCInterfaceDecl *Super = 0);
   void CodeCompleteObjCForCollection(Scope *S, 
                                      DeclGroupPtrTy IterationVar);
   void CodeCompleteObjCSelector(Scope *S,

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=116436&r1=116435&r2=116436&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Wed Oct 13 16:24:53 2010
@@ -4449,16 +4449,11 @@
     if (CurMethod->isInstanceMethod()) {
       // We are inside an instance method, which means that the message
       // send [super ...] is actually calling an instance method on the
-      // current object. Build the super expression and handle this like
-      // an instance method.
-      QualType SuperTy = Context.getObjCInterfaceType(CDecl);
-      SuperTy = Context.getObjCObjectPointerType(SuperTy);
-      ExprResult Super
-        = Owned(new (Context) ObjCSuperExpr(SuperLoc, SuperTy));
-      return CodeCompleteObjCInstanceMessage(S, (Expr *)Super.get(),
+      // current object.
+      return CodeCompleteObjCInstanceMessage(S, 0,
                                              SelIdents, NumSelIdents,
                                              AtArgumentExpression,
-                                             /*IsSuper=*/true);
+                                             CDecl);
     }
 
     // Fall through to send to the superclass in CDecl.
@@ -4644,7 +4639,7 @@
                                            IdentifierInfo **SelIdents,
                                            unsigned NumSelIdents,
                                            bool AtArgumentExpression,
-                                           bool IsSuper) {
+                                           ObjCInterfaceDecl *Super) {
   typedef CodeCompletionResult Result;
   
   Expr *RecExpr = static_cast<Expr *>(Receiver);
@@ -4653,7 +4648,10 @@
   // C99 6.7.5.3p[7,8].
   if (RecExpr)
     DefaultFunctionArrayLvalueConversion(RecExpr);
-  QualType ReceiverType = RecExpr? RecExpr->getType() : Context.getObjCIdType();
+  QualType ReceiverType = RecExpr? RecExpr->getType() 
+                          : Super? Context.getObjCObjectPointerType(
+                                            Context.getObjCInterfaceType(Super))
+                                 : Context.getObjCIdType();
   
   // Build the set of methods we can see.
   ResultBuilder Results(*this, CodeCompletionContext::CCC_Other);
@@ -4661,7 +4659,7 @@
 
   // If this is a send-to-super, try to add the special "super" send 
   // completion.
-  if (IsSuper) {
+  if (Super) {
     if (ObjCMethodDecl *SuperMethod
           = AddSuperSendCompletion(*this, false, SelIdents, NumSelIdents, 
                                    Results))





More information about the cfe-commits mailing list