Assert type used in virtual dispatch.

This commit is contained in:
Nikolay Igotti
2017-02-06 14:40:12 +03:00
parent f2a611d4d2
commit 6c33db34da
@@ -1884,6 +1884,7 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid
fun callVirtual(descriptor: FunctionDescriptor, args: List<LLVMValueRef>,
resultLifetime: Lifetime): LLVMValueRef {
assert(LLVMTypeOf(args[0]) == codegen.kObjHeaderPtr)
val typeInfoPtrPtr = LLVMBuildStructGEP(codegen.builder, args[0], 0 /* type_info */, "")!!
val typeInfoPtr = codegen.load(typeInfoPtrPtr)
assert (typeInfoPtr.type == codegen.kTypeInfoPtr)