When completing Objective-C instance method invocations, perform a contextual conversion to an Objective-C pointer type of the target expression if needed. This fixes code completion of method invocations where the target is a smart pointer that has an explicit conversion operator to an Objective-C type.
llvm-svn: 202529
This commit is contained in:
@@ -5529,7 +5529,7 @@ void Sema::CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
|
||||
// If we're messaging an expression with type "id" or "Class", check
|
||||
// whether we know something special about the receiver that allows
|
||||
// us to assume a more-specific receiver type.
|
||||
if (ReceiverType->isObjCIdType() || ReceiverType->isObjCClassType())
|
||||
if (ReceiverType->isObjCIdType() || ReceiverType->isObjCClassType()) {
|
||||
if (ObjCInterfaceDecl *IFace = GetAssumedMessageSendExprType(RecExpr)) {
|
||||
if (ReceiverType->isObjCClassType())
|
||||
return CodeCompleteObjCClassMessage(S,
|
||||
@@ -5540,6 +5540,13 @@ void Sema::CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
|
||||
ReceiverType = Context.getObjCObjectPointerType(
|
||||
Context.getObjCInterfaceType(IFace));
|
||||
}
|
||||
} else if (RecExpr && getLangOpts().CPlusPlus) {
|
||||
ExprResult Conv = PerformContextuallyConvertToObjCPointer(RecExpr);
|
||||
if (Conv.isUsable()) {
|
||||
RecExpr = Conv.take();
|
||||
ReceiverType = RecExpr->getType();
|
||||
}
|
||||
}
|
||||
|
||||
// Build the set of methods we can see.
|
||||
ResultBuilder Results(*this, CodeCompleter->getAllocator(),
|
||||
|
||||
Reference in New Issue
Block a user