[K/N] Fix CallsChecker handling objc_msgSendSuper2.
This commit is contained in:
committed by
Space Team
parent
c6b32200df
commit
4d07fdf97e
+6
-1
@@ -126,8 +126,13 @@ private class CallsChecker(generationState: NativeGenerationState, goodFunctions
|
|||||||
if (LLVMGetNumArgOperands(call) < 2) continue
|
if (LLVMGetNumArgOperands(call) < 2) continue
|
||||||
callSiteDescription = "$functionName (over objc_msgSendSuper2)"
|
callSiteDescription = "$functionName (over objc_msgSendSuper2)"
|
||||||
calledName = null
|
calledName = null
|
||||||
val superStruct = LLVMGetArgOperand(call, 0)
|
// This is https://developer.apple.com/documentation/objectivec/objc_super?language=objc
|
||||||
|
// We don't want to look this type up, so let's just use our own struct.
|
||||||
|
// TODO: Do we need this with fresh LLVM?
|
||||||
val superStructType = llvm.structType(llvm.int8PtrType, llvm.int8PtrType)
|
val superStructType = llvm.structType(llvm.int8PtrType, llvm.int8PtrType)
|
||||||
|
val superStruct = LLVMGetArgOperand(call, 0).run {
|
||||||
|
LLVMBuildBitCast(builder, this, pointerType(superStructType), "")!!
|
||||||
|
}
|
||||||
val superClassPtrPtr = LLVMBuildStructGEP2(builder, superStructType, superStruct, 1, "")
|
val superClassPtrPtr = LLVMBuildStructGEP2(builder, superStructType, superStruct, 1, "")
|
||||||
val superClassPtr = LLVMBuildLoad2(builder, llvm.int8PtrType, superClassPtrPtr, "")!!
|
val superClassPtr = LLVMBuildLoad2(builder, llvm.int8PtrType, superClassPtrPtr, "")!!
|
||||||
val classPtr = getSuperClass.buildCall(builder, listOf(superClassPtr))
|
val classPtr = getSuperClass.buildCall(builder, listOf(superClassPtr))
|
||||||
|
|||||||
Reference in New Issue
Block a user