2222
2323use llvm;
2424use llvm:: AttributePlace :: Function ;
25- use rustc:: ty:: { self , Ty } ;
25+ use rustc:: ty:: { self , PolyFnSig } ;
2626use rustc:: ty:: layout:: LayoutOf ;
2727use rustc:: session:: config:: Sanitizer ;
2828use rustc_data_structures:: small_c_str:: SmallCStr ;
2929use rustc_target:: spec:: PanicStrategy ;
3030use abi:: { Abi , FnType , FnTypeExt } ;
3131use attributes;
3232use context:: CodegenCx ;
33- use common;
3433use type_:: Type ;
3534use value:: Value ;
3635
@@ -129,12 +128,9 @@ pub fn declare_cfn(cx: &CodegenCx<'ll, '_>, name: &str, fn_type: &'ll Type) -> &
129128pub fn declare_fn (
130129 cx : & CodegenCx < ' ll , ' tcx > ,
131130 name : & str ,
132- fn_type : Ty < ' tcx > ,
133- is_vtable_shim : bool ,
131+ sig : PolyFnSig < ' tcx > ,
134132) -> & ' ll Value {
135- debug ! ( "declare_rust_fn(name={:?}, fn_type={:?}, is_vtable_shim={:?})" ,
136- name, fn_type, is_vtable_shim) ;
137- let sig = common:: ty_fn_sig_vtable ( cx, fn_type, is_vtable_shim) ;
133+ debug ! ( "declare_rust_fn(name={:?}, sig={:?})" , name, sig) ;
138134 let sig = cx. tcx . normalize_erasing_late_bound_regions ( ty:: ParamEnv :: reveal_all ( ) , & sig) ;
139135 debug ! ( "declare_rust_fn (after region erasure) sig={:?}" , sig) ;
140136
@@ -186,12 +182,12 @@ pub fn define_private_global(cx: &CodegenCx<'ll, '_>, ty: &'ll Type) -> &'ll Val
186182pub fn define_fn (
187183 cx : & CodegenCx < ' ll , ' tcx > ,
188184 name : & str ,
189- fn_type : Ty < ' tcx > ,
185+ fn_sig : PolyFnSig < ' tcx > ,
190186) -> & ' ll Value {
191187 if get_defined_value ( cx, name) . is_some ( ) {
192188 cx. sess ( ) . fatal ( & format ! ( "symbol `{}` already defined" , name) )
193189 } else {
194- declare_fn ( cx, name, fn_type , false )
190+ declare_fn ( cx, name, fn_sig )
195191 }
196192}
197193
@@ -203,9 +199,9 @@ pub fn define_fn(
203199pub fn define_internal_fn (
204200 cx : & CodegenCx < ' ll , ' tcx > ,
205201 name : & str ,
206- fn_type : Ty < ' tcx > ,
202+ fn_sig : PolyFnSig < ' tcx > ,
207203) -> & ' ll Value {
208- let llfn = define_fn ( cx, name, fn_type ) ;
204+ let llfn = define_fn ( cx, name, fn_sig ) ;
209205 unsafe { llvm:: LLVMRustSetLinkage ( llfn, llvm:: Linkage :: InternalLinkage ) } ;
210206 llfn
211207}
0 commit comments