1
Fork 0

Use get_function_name_and_sig for calling function from backend

This commit is contained in:
bjorn3 2018-08-11 14:10:00 +02:00
parent 50375db36c
commit d5a5aec022
2 changed files with 2 additions and 7 deletions

View file

@ -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)
}
fn get_function_name_and_sig<'a, 'tcx>(
pub fn get_function_name_and_sig<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
inst: Instance<'tcx>,
) -> (String, Signature) {

View file

@ -298,12 +298,7 @@ impl CodegenBackend for CraneliftCodegenBackend {
}
}).unwrap();
let fn_ty = call_instance.ty(tcx);
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 (name, sig) = crate::abi::get_function_name_and_sig(tcx, call_instance);
let called_func_id = module
.declare_function(&name, Linkage::Import, &sig)
.unwrap();