Make the interface to metadata::csearch more consistent

This commit is contained in:
Brian Anderson 2011-07-07 22:57:09 -07:00
parent 85212840c0
commit 06391dda02
4 changed files with 25 additions and 21 deletions

View file

@ -1143,7 +1143,7 @@ fn ns_for_def(def d) -> namespace {
fn lookup_external(&env e, int cnum, vec[ident] ids, namespace ns) ->
option::t[def] {
for (def d in csearch::lookup_defs(e.sess, cnum, ids)) {
for (def d in csearch::lookup_defs(e.sess.get_cstore(), cnum, ids)) {
e.ext_map.insert(ast::def_id_of_def(d), ids);
if (ns == ns_for_def(d)) { ret some(d); }
}

View file

@ -2220,12 +2220,13 @@ fn trans_res_drop(@block_ctxt cx, ValueRef rs, &ast::def_id did,
case (_) { ccx.tcx.sess.bug("internal error in trans_res_drop") }
}
} else {
auto params = csearch::get_type_param_count(ccx.tcx, did);
auto params = csearch::get_type_param_count(ccx.sess.get_cstore(),
did);
auto f_t = type_of_fn(ccx, cx.sp, ast::proto_fn,
~[rec(mode=ty::mo_alias(false), ty=inner_t)],
ty::mk_nil(ccx.tcx), params);
get_extern_const(ccx.externs, ccx.llmod,
csearch::get_symbol(ccx.sess, did),
csearch::get_symbol(ccx.sess.get_cstore(), did),
T_fn_pair(ccx.tn, f_t))
};
auto dtor_addr = cx.build.Load
@ -4942,7 +4943,7 @@ fn lval_val(&@block_ctxt cx, ValueRef val) -> lval_result {
fn trans_external_path(&@block_ctxt cx, &ast::def_id did,
&ty::ty_param_count_and_ty tpt) -> lval_result {
auto lcx = cx.fcx.lcx;
auto name = csearch::get_symbol(lcx.ccx.sess, did);
auto name = csearch::get_symbol(lcx.ccx.sess.get_cstore(), did);
auto v =
get_extern_const(lcx.ccx.externs, lcx.ccx.llmod, name,
type_of_ty_param_count_and_ty(lcx, cx.sp, tpt));
@ -4988,7 +4989,7 @@ fn lookup_discriminant(&@local_ctxt lcx, &ast::def_id tid, &ast::def_id vid)
// It's an external discriminant that we haven't seen yet.
assert (vid._0 != ast::local_crate);
auto sym = csearch::get_symbol(lcx.ccx.sess, vid);
auto sym = csearch::get_symbol(lcx.ccx.sess.get_cstore(), vid);
auto gvar =
llvm::LLVMAddGlobal(lcx.ccx.llmod, T_int(), str::buf(sym));
llvm::LLVMSetLinkage(gvar,