Support link_args at the crate level. Closes #1301
This commit is contained in:
parent
9ad8a1f465
commit
19eb225bc2
@ -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);
|
||||
@ -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) => {
|
||||
|
Loading…
Reference in New Issue
Block a user