Move used_link_args from session to cstore

This commit is contained in:
Brian Anderson 2011-07-07 18:38:42 -07:00
parent 4bfa269fe7
commit 58d288a4f7
4 changed files with 12 additions and 10 deletions

View File

@ -355,7 +355,7 @@ fn build_session(@session::options sopts) -> session::session {
auto target_cfg = build_target_config();
auto cstore = cstore::mk_cstore();
ret session::session(target_cfg, sopts, cstore,
[], codemap::new_codemap(), 0u);
codemap::new_codemap(), 0u);
}
fn parse_pretty(session::session sess, &str name) -> pp_mode {
@ -527,7 +527,7 @@ fn main(vec[str] args) {
gcc_args += ["-l" + libarg];
}
gcc_args += sess.get_used_link_args();
gcc_args += cstore::get_used_link_args(cstore);
auto used_libs = cstore::get_used_libraries(cstore);
for (str l in used_libs) {
gcc_args += ["-l" + l];

View File

@ -46,7 +46,6 @@ type crate_metadata = rec(str name, vec[u8] data);
obj session(@config targ_cfg,
@options opts,
metadata::cstore::cstore cstore,
mutable vec[str] used_link_args,
codemap::codemap cm,
mutable uint err_count) {
fn get_targ_cfg() -> @config { ret targ_cfg; }
@ -98,12 +97,6 @@ obj session(@config targ_cfg,
self.span_bug(sp, "unimplemented " + msg);
}
fn unimpl(str msg) -> ! { self.bug("unimplemented " + msg); }
fn add_used_link_args(&str args) {
used_link_args += str::split(args, ' ' as u8);
}
fn get_used_link_args() -> vec[str] {
ret used_link_args;
}
fn get_codemap() -> codemap::codemap { ret cm; }
fn lookup_pos(uint pos) -> codemap::loc {
ret codemap::lookup_pos(cm, pos);

View File

@ -188,7 +188,7 @@ fn visit_item(env e, &@ast::item i) {
attr::find_attrs_by_name(i.attrs, "link_args")) {
alt (attr::get_meta_item_value_str(attr::attr_meta(a))) {
case (some(?linkarg)) {
e.sess.add_used_link_args(linkarg);
cstore::add_used_link_args(cstore, linkarg);
}
case (none) { /* fallthrough */ }
}

View File

@ -1,5 +1,6 @@
import std::map;
import std::vec;
import std::str;
type crate_metadata = rec(str name, vec[u8] data);
@ -53,6 +54,14 @@ fn get_used_libraries(&cstore cstore) -> vec[str] {
ret cstore.used_libraries;
}
fn add_used_link_args(&cstore cstore, &str args) {
cstore.used_link_args += str::split(args, ' ' as u8);
}
fn get_used_link_args(&cstore cstore) -> vec[str] {
ret cstore.used_link_args;
}
// Local Variables:
// mode: rust
// fill-column: 78;