From 6b0656a7c386662e1bec5f23a3bd0bf2687a9635 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 13 Oct 2010 21:24:53 +0000 Subject: [PATCH] Eliminate the use of ObjCSuperExpr in code completion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116436 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Sema/Sema.h | 2 +- lib/Sema/SemaCodeComplete.cpp | 20 +++++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h index 144c58d1bb..d9057a1e0d 100644 --- a/include/clang/Sema/Sema.h +++ b/include/clang/Sema/Sema.h @@ -4399,7 +4399,7 @@ public: IdentifierInfo **SelIdents, unsigned NumSelIdents, bool AtArgumentExpression, - bool IsSuper = false); + ObjCInterfaceDecl *Super = 0); void CodeCompleteObjCForCollection(Scope *S, DeclGroupPtrTy IterationVar); void CodeCompleteObjCSelector(Scope *S, diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index 9ad653731f..9b504113f9 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -4449,16 +4449,11 @@ void Sema::CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc, 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 @@ void Sema::CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver, IdentifierInfo **SelIdents, unsigned NumSelIdents, bool AtArgumentExpression, - bool IsSuper) { + ObjCInterfaceDecl *Super) { typedef CodeCompletionResult Result; Expr *RecExpr = static_cast(Receiver); @@ -4653,7 +4648,10 @@ void Sema::CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver, // 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 @@ void Sema::CodeCompleteObjCInstanceMessage(Scope *S, ExprTy *Receiver, // 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)) -- 2.40.0