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> {
130
130
}
131
131
}
132
132
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
-
155
133
fn get_declared_value ( & self , name : & str ) -> Option < & ' ll Value > {
156
134
debug ! ( "get_declared_value(name={:?})" , name) ;
157
135
let namebuf = SmallCStr :: new ( name) ;
Original file line number Diff line number Diff line change @@ -1013,7 +1013,9 @@ fn gen_fn<'ll, 'tcx>(
1013
1013
hir:: Unsafety :: Unsafe ,
1014
1014
Abi :: Rust
1015
1015
) ) ;
1016
- let llfn = cx. define_internal_fn ( name, rust_fn_sig) ;
1016
+ let llfn = cx. declare_fn ( name, rust_fn_sig) ;
1017
+ // FIXME(eddyb) find a nicer way to do this.
1018
+ unsafe { llvm:: LLVMRustSetLinkage ( llfn, llvm:: Linkage :: InternalLinkage ) } ;
1017
1019
attributes:: from_fn_attrs ( cx, llfn, None , rust_fn_sig) ;
1018
1020
let bx = Builder :: new_block ( cx, llfn, "entry-block" ) ;
1019
1021
codegen ( bx) ;
Original file line number Diff line number Diff line change @@ -38,20 +38,6 @@ pub trait DeclareMethods<'tcx>: BackendTypes {
38
38
/// Use this function when you intend to define a global without a name.
39
39
fn define_private_global ( & self , ty : Self :: Type ) -> Self :: Value ;
40
40
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
-
55
41
/// Gets declared value by name.
56
42
fn get_declared_value ( & self , name : & str ) -> Option < Self :: Value > ;
57
43
You can’t perform that action at this time.
0 commit comments