Skip to content

Commit

Permalink
Support link_args at the crate level. Closes #1301
Browse files Browse the repository at this point in the history
  • Loading branch information
z0w0 committed Feb 16, 2013
1 parent 9ad8a1f commit 19eb225
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/librustc/metadata/creader.rs
Expand Up @@ -55,6 +55,7 @@ pub fn read_crates(diag: span_handler,
visit_view_item: |a| visit_view_item(e, a),
visit_item: |a| visit_item(e, a),
.. *visit::default_simple_visitor()});
visit_crate(e, crate);
visit::visit_crate(crate, (), v);
dump_crates(e.crate_cache);
warn_if_multiple_versions(e, diag, e.crate_cache);
Expand Down Expand Up @@ -125,6 +126,20 @@ struct Env {
intr: @ident_interner
}

fn visit_crate(e: @mut Env, c: ast::crate) {
let cstore = e.cstore;
let link_args = attr::find_attrs_by_name(c.node.attrs, "link_args");

for link_args.each |a| {
match attr::get_meta_item_value_str(attr::attr_meta(*a)) {
Some(ref linkarg) => {
cstore::add_used_link_args(cstore, (/*bad*/copy *linkarg));
}
None => {/* fallthrough */ }
}
}
}

fn visit_view_item(e: @mut Env, i: @ast::view_item) {
match /*bad*/copy i.node {
ast::view_item_use(ident, meta_items, id) => {
Expand Down

1 comment on commit 19eb225

@graydon
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

Please sign in to comment.