mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[IRGen] Handle 'super' method sends in ObjC partial application forwarders.
The Objective-C partial application forwarder that one gets when using, e.g., "super.foo" as a function value was doing a normal objc_msgSend. Fix the miscompile by threading all of the information about the Objective-C message send through the forwarder. Fixes rdar://problem/28140758.
This commit is contained in:
@@ -786,7 +786,7 @@ llvm::Value *irgen::emitObjCAllocObjectCall(IRGenFunction &IGF,
|
||||
}
|
||||
|
||||
static llvm::Function *emitObjCPartialApplicationForwarder(IRGenModule &IGM,
|
||||
SILDeclRef method,
|
||||
ObjCMethod method,
|
||||
CanSILFunctionType origMethodType,
|
||||
CanSILFunctionType resultType,
|
||||
const HeapLayout &layout,
|
||||
@@ -884,10 +884,12 @@ static llvm::Function *emitObjCPartialApplicationForwarder(IRGenModule &IGM,
|
||||
}
|
||||
|
||||
// Prepare the call to the underlying method.
|
||||
|
||||
CallEmission emission
|
||||
= prepareObjCMethodRootCall(subIGF, method, origMethodType, origMethodType,
|
||||
= prepareObjCMethodRootCall(subIGF, method.getMethod(),
|
||||
origMethodType, origMethodType,
|
||||
ArrayRef<Substitution>{},
|
||||
ObjCMessageKind::Normal);
|
||||
method.getMessageKind());
|
||||
|
||||
Explosion args;
|
||||
|
||||
@@ -895,7 +897,8 @@ static llvm::Function *emitObjCPartialApplicationForwarder(IRGenModule &IGM,
|
||||
if (formalIndirectResult)
|
||||
args.add(formalIndirectResult);
|
||||
|
||||
addObjCMethodCallImplicitArguments(subIGF, args, method, self, SILType());
|
||||
addObjCMethodCallImplicitArguments(subIGF, args, method.getMethod(), self,
|
||||
method.getSearchType());
|
||||
args.add(params.claimAll());
|
||||
emission.setArgs(args);
|
||||
|
||||
@@ -930,7 +933,7 @@ static llvm::Function *emitObjCPartialApplicationForwarder(IRGenModule &IGM,
|
||||
}
|
||||
|
||||
void irgen::emitObjCPartialApplication(IRGenFunction &IGF,
|
||||
SILDeclRef method,
|
||||
ObjCMethod method,
|
||||
CanSILFunctionType origMethodType,
|
||||
CanSILFunctionType resultType,
|
||||
llvm::Value *self,
|
||||
|
||||
Reference in New Issue
Block a user