Use get_function_name_and_sig for calling function from backend
This commit is contained in:
parent
50375db36c
commit
d5a5aec022
2 changed files with 2 additions and 7 deletions
|
@ -153,7 +153,7 @@ fn ty_fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty: Ty<'tcx>) -> ty::FnSig<'
|
||||||
tcx.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), &sig)
|
tcx.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), &sig)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_function_name_and_sig<'a, 'tcx>(
|
pub fn get_function_name_and_sig<'a, 'tcx>(
|
||||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
inst: Instance<'tcx>,
|
inst: Instance<'tcx>,
|
||||||
) -> (String, Signature) {
|
) -> (String, Signature) {
|
||||||
|
|
|
@ -298,12 +298,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
|
||||||
}
|
}
|
||||||
}).unwrap();
|
}).unwrap();
|
||||||
|
|
||||||
let fn_ty = call_instance.ty(tcx);
|
let (name, sig) = crate::abi::get_function_name_and_sig(tcx, call_instance);
|
||||||
let sig = cton_sig_from_fn_ty(tcx, fn_ty);
|
|
||||||
let def_path_based_names =
|
|
||||||
::rustc_mir::monomorphize::item::DefPathBasedNames::new(tcx, false, false);
|
|
||||||
let mut name = String::new();
|
|
||||||
def_path_based_names.push_instance_as_string(call_instance, &mut name);
|
|
||||||
let called_func_id = module
|
let called_func_id = module
|
||||||
.declare_function(&name, Linkage::Import, &sig)
|
.declare_function(&name, Linkage::Import, &sig)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue