File tree Expand file tree Collapse file tree 3 files changed +3
-37
lines changed
librustc_codegen_ssa/traits Expand file tree Collapse file tree 3 files changed +3
-37
lines changed Original file line number Diff line number Diff line change @@ -130,28 +130,6 @@ impl DeclareMethods<'tcx> for CodegenCx<'ll, 'tcx> {
130130 }
131131 }
132132
133- fn define_fn (
134- & self ,
135- name : & str ,
136- fn_sig : PolyFnSig < ' tcx > ,
137- ) -> & ' ll Value {
138- if self . get_defined_value ( name) . is_some ( ) {
139- self . sess ( ) . fatal ( & format ! ( "symbol `{}` already defined" , name) )
140- } else {
141- self . declare_fn ( name, fn_sig)
142- }
143- }
144-
145- fn define_internal_fn (
146- & self ,
147- name : & str ,
148- fn_sig : PolyFnSig < ' tcx > ,
149- ) -> & ' ll Value {
150- let llfn = self . define_fn ( name, fn_sig) ;
151- unsafe { llvm:: LLVMRustSetLinkage ( llfn, llvm:: Linkage :: InternalLinkage ) } ;
152- llfn
153- }
154-
155133 fn get_declared_value ( & self , name : & str ) -> Option < & ' ll Value > {
156134 debug ! ( "get_declared_value(name={:?})" , name) ;
157135 let namebuf = SmallCStr :: new ( name) ;
Original file line number Diff line number Diff line change @@ -1009,7 +1009,9 @@ fn gen_fn<'ll, 'tcx>(
10091009 hir:: Unsafety :: Unsafe ,
10101010 Abi :: Rust
10111011 ) ) ;
1012- let llfn = cx. define_internal_fn ( name, rust_fn_sig) ;
1012+ let llfn = cx. declare_fn ( name, rust_fn_sig) ;
1013+ // FIXME(eddyb) find a nicer way to do this.
1014+ unsafe { llvm:: LLVMRustSetLinkage ( llfn, llvm:: Linkage :: InternalLinkage ) } ;
10131015 attributes:: from_fn_attrs ( cx, llfn, None , rust_fn_sig) ;
10141016 let bx = Builder :: new_block ( cx, llfn, "entry-block" ) ;
10151017 codegen ( bx) ;
Original file line number Diff line number Diff line change @@ -38,20 +38,6 @@ pub trait DeclareMethods<'tcx>: BackendTypes {
3838 /// Use this function when you intend to define a global without a name.
3939 fn define_private_global ( & self , ty : Self :: Type ) -> Self :: Value ;
4040
41- /// Declare a Rust function with an intention to define it.
42- ///
43- /// Use this function when you intend to define a function. This function will
44- /// return panic if the name already has a definition associated with it. This
45- /// can happen with #[no_mangle] or #[export_name], for example.
46- fn define_fn ( & self , name : & str , fn_sig : ty:: PolyFnSig < ' tcx > ) -> Self :: Value ;
47-
48- /// Declare a Rust function with an intention to define it.
49- ///
50- /// Use this function when you intend to define a function. This function will
51- /// return panic if the name already has a definition associated with it. This
52- /// can happen with #[no_mangle] or #[export_name], for example.
53- fn define_internal_fn ( & self , name : & str , fn_sig : ty:: PolyFnSig < ' tcx > ) -> Self :: Value ;
54-
5541 /// Gets declared value by name.
5642 fn get_declared_value ( & self , name : & str ) -> Option < Self :: Value > ;
5743
You can’t perform that action at this time.
0 commit comments