diff --git a/App/lib/core/Gen/CallGenCall.vp b/App/lib/core/Gen/CallGenCall.vp index 7c49441..02d43b3 100644 --- a/App/lib/core/Gen/CallGenCall.vp +++ b/App/lib/core/Gen/CallGenCall.vp @@ -989,6 +989,11 @@ class CallGenCall(CallGenBase.CallGenBase): builder, i8_ty_th, obj_i8_th, delta_val_th) if adj_th is not None: anc_ptr_ty_th: llvmlite.LLVMType | t.CPtr = llvmlite.Ptr(pool, anc_entry_th.Ty) + # 跨模块基类(如 Generator → ClassGenBase)的完整定义不在本模块, + # bitcast 引用 %"sha1.ClassGenBase" 前必须确保 opaque 声明存在, + # 否则 llc 报 "use of undefined type"(PrintModule 只扫函数签名, + # 函数体内的 bitcast 类型不会被自动声明)。 + llvmlite.module_ensure_opaque_for_type(mod, pool, anc_ptr_ty_th) self_arg = llvmlite.build_bitcast(builder, adj_th, anc_ptr_ty_th) # 构建参数链表: self → arg1 → arg2 → ... llvmlite.value_set_next(self_arg, None) @@ -1324,6 +1329,9 @@ class CallGenCall(CallGenBase.CallGenBase): builder, i8_ty_sp, obj_i8_sp, dval_sp) if adj_sp is not None: anc_ptr_sp: llvmlite.LLVMType | t.CPtr = llvmlite.Ptr(pool, anc_entry_sp.Ty) + # 同上:跨模块祖先类型 bitcast 前确保 opaque 声明, + # 否则 llc 报 "use of undefined type" + llvmlite.module_ensure_opaque_for_type(mod, pool, anc_ptr_sp) self_arg = llvmlite.build_bitcast(builder, adj_sp, anc_ptr_sp) # 4. 查找父类方法函数 + 构造调用名(SHA1 mangled) anc_lookup: str = pool.alloc(160)