Skip to content

Commit e6b9f4b

Browse files
committed
---
yaml --- r: 6828 b: refs/heads/master c: 6637340 h: refs/heads/master v: v3
1 parent 9e36d41 commit e6b9f4b

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
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: 1d3d28bdf169c891a0f3cf82879d8609ba2d44ff
2+
refs/heads/master: 6637340c2860344bacd1554fc025f3d90c80a602

trunk/src/comp/driver/rustc.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ fn build_session_options(match: getopts::match)
489489
ret sopts;
490490
}
491491

492-
fn build_session(sopts: @session::options) -> session::session {
492+
fn build_session(sopts: @session::options, input: str) -> session::session {
493493
let target_cfg = build_target_config(sopts);
494494
let cstore = cstore::mk_cstore();
495495
let filesearch = filesearch::mk_filesearch(
@@ -498,7 +498,7 @@ fn build_session(sopts: @session::options) -> session::session {
498498
sopts.addl_lib_search_paths);
499499
ret session::session(target_cfg, sopts, cstore,
500500
@{cm: codemap::new_codemap(), mutable next_id: 1},
501-
none, 0u, filesearch, false);
501+
none, 0u, filesearch, false, fs::dirname(input));
502502
}
503503

504504
fn parse_pretty(sess: session::session, &&name: str) -> pp_mode {
@@ -644,7 +644,7 @@ fn main(args: [str]) {
644644
};
645645

646646
let sopts = build_session_options(match);
647-
let sess = build_session(sopts);
647+
let sess = build_session(sopts, ifile);
648648
let odir = getopts::opt_maybe_str(match, "out-dir");
649649
let ofile = getopts::opt_maybe_str(match, "o");
650650
let cfg = build_configuration(sess, binary, ifile);
@@ -676,7 +676,7 @@ mod test {
676676
ok(m) { m }
677677
};
678678
let sessopts = build_session_options(match);
679-
let sess = build_session(sessopts);
679+
let sess = build_session(sessopts, "");
680680
let cfg = build_configuration(sess, "whatever", "whatever");
681681
assert (attr::contains_name(cfg, "test"));
682682
}
@@ -690,7 +690,7 @@ mod test {
690690
ok(m) { m }
691691
};
692692
let sessopts = build_session_options(match);
693-
let sess = build_session(sessopts);
693+
let sess = build_session(sessopts, "");
694694
let cfg = build_configuration(sess, "whatever", "whatever");
695695
let test_items = attr::find_meta_items_by_name(cfg, "test");
696696
assert (vec::len(test_items) == 1u);

trunk/src/comp/driver/session.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ obj session(targ_cfg: @config,
6060
mutable main_fn: option::t<node_id>,
6161
mutable err_count: uint,
6262
filesearch: filesearch::filesearch,
63-
mutable building_library: bool) {
63+
mutable building_library: bool,
64+
working_dir: str) {
6465
fn get_targ_cfg() -> @config { ret targ_cfg; }
6566
fn get_opts() -> @options { ret opts; }
6667
fn get_cstore() -> metadata::cstore::cstore { cstore }
@@ -123,6 +124,9 @@ obj session(targ_cfg: @config,
123124
fn set_building_library(crate: @ast::crate) {
124125
building_library = session::building_library(opts.crate_type, crate);
125126
}
127+
fn get_working_dir() -> str {
128+
ret working_dir;
129+
}
126130
}
127131

128132
fn building_library(req_crate_type: crate_type, crate: @ast::crate) -> bool {

trunk/src/comp/middle/debuginfo.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,18 @@ fn create_compile_unit(cx: @crate_ctxt, full_path: str)
162162
option::none. {}
163163
}
164164

165-
let fname = fs::basename(full_path);
166-
let path = fs::dirname(full_path);
165+
let work_dir = cx.sess.get_working_dir();
166+
let file_path = if str::starts_with(full_path, work_dir) {
167+
str::slice(full_path, str::byte_len(work_dir),
168+
str::byte_len(full_path))
169+
} else {
170+
full_path
171+
};
167172
let unit_metadata = [lltag(tg),
168173
llunused(),
169174
lli32(DW_LANG_RUST),
170-
llstr(fname),
171-
llstr(path),
175+
llstr(file_path),
176+
llstr(work_dir),
172177
llstr(#env["CFG_VERSION"]),
173178
lli1(false), // main compile unit
174179
lli1(cx.sess.get_opts().optimize != 0u),

0 commit comments

Comments
 (0)