Skip to content

Commit 38aa70e

Browse files
committed
---
yaml --- r: 3724 b: refs/heads/master c: 4bfa269 h: refs/heads/master v: v3
1 parent c16adf7 commit 38aa70e

File tree

5 files changed

+22
-23
lines changed

5 files changed

+22
-23
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 1386420cad0ed926de268dff0648a815c317c032
2+
refs/heads/master: 4bfa269fe7ce48c7cd54404b4f74c48e0e7895ea

trunk/src/comp/driver/rustc.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ fn build_session(@session::options sopts) -> session::session {
355355
auto target_cfg = build_target_config();
356356
auto cstore = cstore::mk_cstore();
357357
ret session::session(target_cfg, sopts, cstore,
358-
[], [], codemap::new_codemap(), 0u);
358+
[], codemap::new_codemap(), 0u);
359359
}
360360

361361
fn parse_pretty(session::session sess, &str name) -> pp_mode {
@@ -517,7 +517,8 @@ fn main(vec[str] args) {
517517
};
518518
}
519519

520-
for (str cratepath in cstore::get_used_crate_files(sess.get_cstore())) {
520+
auto cstore = sess.get_cstore();
521+
for (str cratepath in cstore::get_used_crate_files(cstore)) {
521522
auto dir = fs::dirname(cratepath);
522523
if (dir != "") {
523524
gcc_args += ["-L" + dir];
@@ -527,7 +528,7 @@ fn main(vec[str] args) {
527528
}
528529

529530
gcc_args += sess.get_used_link_args();
530-
auto used_libs = sess.get_used_libraries();
531+
auto used_libs = cstore::get_used_libraries(cstore);
531532
for (str l in used_libs) {
532533
gcc_args += ["-l" + l];
533534
}

trunk/src/comp/driver/session.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ type crate_metadata = rec(str name, vec[u8] data);
4646
obj session(@config targ_cfg,
4747
@options opts,
4848
metadata::cstore::cstore cstore,
49-
mutable vec[str] used_libraries,
5049
mutable vec[str] used_link_args,
5150
codemap::codemap cm,
5251
mutable uint err_count) {
@@ -105,23 +104,6 @@ obj session(@config targ_cfg,
105104
fn get_used_link_args() -> vec[str] {
106105
ret used_link_args;
107106
}
108-
fn add_used_library(&str lib) -> bool {
109-
if (lib == "") {
110-
ret false;
111-
}
112-
// A program has a small number of libraries, so a vector is probably
113-
// a good data structure in here.
114-
for (str l in used_libraries) {
115-
if (l == lib) {
116-
ret false;
117-
}
118-
}
119-
used_libraries += [lib];
120-
ret true;
121-
}
122-
fn get_used_libraries() -> vec[str] {
123-
ret used_libraries;
124-
}
125107
fn get_codemap() -> codemap::codemap { ret cm; }
126108
fn lookup_pos(uint pos) -> codemap::loc {
127109
ret codemap::lookup_pos(cm, pos);

trunk/src/comp/metadata/creader.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ fn visit_item(env e, &@ast::item i) {
180180
m.abi != ast::native_abi_cdecl) {
181181
ret;
182182
}
183-
if (!e.sess.add_used_library(m.native_name)) {
183+
auto cstore = e.sess.get_cstore();
184+
if (!cstore::add_used_library(cstore, m.native_name)) {
184185
ret;
185186
}
186187
for (ast::attribute a in

trunk/src/comp/metadata/cstore.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ fn get_used_crate_files(&cstore cstore) -> vec[str] {
3838
ret cstore.used_crate_files;
3939
}
4040

41+
fn add_used_library(&cstore cstore, &str lib) -> bool {
42+
if (lib == "") { ret false; }
43+
44+
if (vec::member(lib, cstore.used_libraries)) {
45+
ret false;
46+
}
47+
48+
cstore.used_libraries += [lib];
49+
ret true;
50+
}
51+
52+
fn get_used_libraries(&cstore cstore) -> vec[str] {
53+
ret cstore.used_libraries;
54+
}
55+
4156
// Local Variables:
4257
// mode: rust
4358
// fill-column: 78;

0 commit comments

Comments
 (0)