Fix an unused variable warning and clean up some dead code/names.

This commit is contained in:
Michael Sullivan
2013-07-29 14:19:04 -07:00
parent bcf62e7901
commit a20081666b
3 changed files with 13 additions and 21 deletions

View File

@@ -2218,23 +2218,14 @@ pub fn trans_mod(ccx: @mut CrateContext, m: &ast::_mod) {
pub fn register_fn(ccx: @mut CrateContext, pub fn register_fn(ccx: @mut CrateContext,
sp: span, sp: span,
sym: ~str, sym: ~str,
node_id: ast::NodeId) node_id: ast::NodeId,
-> ValueRef { node_type: ty::t)
let t = ty::node_id_to_type(ccx.tcx, node_id); -> ValueRef {
register_fn_full(ccx, sp, sym, node_id, t)
}
pub fn register_fn_full(ccx: @mut CrateContext,
sp: span,
sym: ~str,
node_id: ast::NodeId,
node_type: ty::t)
-> ValueRef {
let llfty = type_of_fn_from_ty(ccx, node_type); let llfty = type_of_fn_from_ty(ccx, node_type);
register_fn_fuller(ccx, sp, sym, node_id, lib::llvm::CCallConv, llfty) register_fn_llvmty(ccx, sp, sym, node_id, lib::llvm::CCallConv, llfty)
} }
pub fn register_fn_fuller(ccx: @mut CrateContext, pub fn register_fn_llvmty(ccx: @mut CrateContext,
sp: span, sp: span,
sym: ~str, sym: ~str,
node_id: ast::NodeId, node_id: ast::NodeId,
@@ -2449,7 +2440,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
ast::item_fn(_, purity, _, _, _) => { ast::item_fn(_, purity, _, _, _) => {
let llfn = if purity != ast::extern_fn { let llfn = if purity != ast::extern_fn {
register_fn_full(ccx, i.span, sym, i.id, ty) register_fn(ccx, i.span, sym, i.id, ty)
} else { } else {
foreign::register_foreign_fn(ccx, i.span, sym, i.id) foreign::register_foreign_fn(ccx, i.span, sym, i.id)
}; };
@@ -2499,7 +2490,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
let path = vec::append((*pth).clone(), [path_name(ni.ident)]); let path = vec::append((*pth).clone(), [path_name(ni.ident)]);
let sym = exported_name(ccx, path, ty, ni.attrs); let sym = exported_name(ccx, path, ty, ni.attrs);
register_fn_full(ccx, ni.span, sym, ni.id, ty) register_fn(ccx, ni.span, sym, ni.id, ty)
} }
ast::foreign_item_static(*) => { ast::foreign_item_static(*) => {
let ident = token::ident_to_str(&ni.ident); let ident = token::ident_to_str(&ni.ident);
@@ -2527,7 +2518,7 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
llfn = match enm.node { llfn = match enm.node {
ast::item_enum(_, _) => { ast::item_enum(_, _) => {
register_fn_full(ccx, (*v).span, sym, id, ty) register_fn(ccx, (*v).span, sym, id, ty)
} }
_ => fail!("node_variant, shouldn't happen") _ => fail!("node_variant, shouldn't happen")
}; };
@@ -2551,7 +2542,8 @@ pub fn get_item_val(ccx: @mut CrateContext, id: ast::NodeId) -> ValueRef {
let ty = ty::node_id_to_type(ccx.tcx, ctor_id); let ty = ty::node_id_to_type(ccx.tcx, ctor_id);
let sym = exported_name(ccx, (*struct_path).clone(), ty, let sym = exported_name(ccx, (*struct_path).clone(), ty,
struct_item.attrs); struct_item.attrs);
let llfn = register_fn_full(ccx, struct_item.span, sym, ctor_id, ty); let llfn = register_fn(ccx, struct_item.span,
sym, ctor_id, ty);
set_inline_hint(llfn); set_inline_hint(llfn);
llfn llfn
} }
@@ -2586,7 +2578,7 @@ pub fn register_method(ccx: @mut CrateContext,
let sym = exported_name(ccx, path, mty, m.attrs); let sym = exported_name(ccx, path, mty, m.attrs);
let llfn = register_fn_full(ccx, m.span, sym, id, mty); let llfn = register_fn(ccx, m.span, sym, id, mty);
set_inline_hint_if_appr(m.attrs, llfn); set_inline_hint_if_appr(m.attrs, llfn);
llfn llfn
} }

View File

@@ -1157,6 +1157,6 @@ pub fn register_foreign_fn(ccx: @mut CrateContext,
let tys = shim_types(ccx, node_id); let tys = shim_types(ccx, node_id);
do tys.fn_ty.decl_fn |fnty| { do tys.fn_ty.decl_fn |fnty| {
register_fn_fuller(ccx, sp, sym.take(), node_id, lib::llvm::CCallConv, fnty) register_fn_llvmty(ccx, sp, sym.take(), node_id, lib::llvm::CCallConv, fnty)
} }
} }

View File

@@ -410,7 +410,7 @@ impl IdVisitor {
impl Visitor<()> for IdVisitor { impl Visitor<()> for IdVisitor {
fn visit_mod(@mut self, fn visit_mod(@mut self,
module: &_mod, module: &_mod,
span: span, _span: span,
node_id: NodeId, node_id: NodeId,
env: ()) { env: ()) {
(self.visit_callback)(node_id); (self.visit_callback)(node_id);