Skip to content

Commit db477af

Browse files
committed
rustc_codegen_ssa: remove define_fn and define_internal_fn.
1 parent 6a75768 commit db477af

File tree

3 files changed

+3
-37
lines changed

3 files changed

+3
-37
lines changed

src/librustc_codegen_llvm/declare.rs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff 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);

src/librustc_codegen_llvm/intrinsic.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,9 @@ fn gen_fn<'ll, 'tcx>(
10131013
hir::Unsafety::Unsafe,
10141014
Abi::Rust
10151015
));
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) };
10171019
attributes::from_fn_attrs(cx, llfn, None, rust_fn_sig);
10181020
let bx = Builder::new_block(cx, llfn, "entry-block");
10191021
codegen(bx);

src/librustc_codegen_ssa/traits/declare.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)