Skip to content

Commit 1c9a7fd

Browse files
committed
---
yaml --- r: 2332 b: refs/heads/master c: b453c3c h: refs/heads/master v: v3
1 parent 899601c commit 1c9a7fd

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
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: 6871c245a67fab222eccc2a21dcb620d11d3b0d0
2+
refs/heads/master: b453c3c72825f70499819d97b879c805cac1e5b1

trunk/src/comp/driver/rustc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ options:
142142
--ls list the symbols defined by a crate file
143143
-L <path> add a directory to the library search path
144144
--noverify suppress LLVM verification step (slight speedup)
145+
--depend print dependencies, in makefile-rule form
145146
--parse-only parse only; do not compile, assemble, or link
146147
-O optimize
147148
-S compile only; do not assemble or link

trunk/src/comp/front/eval.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,15 @@ tag val {
2424
val_str(str);
2525
}
2626

27+
tag eval_mode {
28+
mode_depend;
29+
mode_parse;
30+
}
31+
2732
type env = vec[tup(ident, val)];
2833
type ctx = @rec(parser p,
34+
eval_mode mode,
35+
mutable vec[str] deps,
2936
session.session sess,
3037
mutable uint chpos);
3138

@@ -383,6 +390,11 @@ fn eval_crate_directive(ctx cx,
383390

384391
auto full_path = prefix + std.fs.path_sep() + file_path;
385392

393+
if (cx.mode == mode_depend) {
394+
cx.deps += vec(full_path);
395+
ret;
396+
}
397+
386398
auto start_id = cx.p.next_def_id();
387399
auto p0 = new_parser(cx.sess, e, start_id, full_path, cx.chpos);
388400
auto m0 = parse_mod_items(p0, token.EOF);

trunk/src/comp/front/parser.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2497,7 +2497,12 @@ fn parse_crate_from_crate_file(parser p) -> @ast.crate {
24972497
auto lo = p.get_lo_pos();
24982498
auto prefix = std.fs.dirname(p.get_filemap().name);
24992499
auto cdirs = parse_crate_directives(p, token.EOF);
2500-
auto cx = @rec(p=p, sess=p.get_session(), mutable chpos=p.get_chpos());
2500+
let vec[str] deps = vec();
2501+
auto cx = @rec(p=p,
2502+
mode=eval.mode_parse,
2503+
mutable deps = deps,
2504+
sess=p.get_session(),
2505+
mutable chpos=p.get_chpos());
25012506
auto m = eval.eval_crate_directives_to_mod(cx, p.get_env(),
25022507
cdirs, prefix);
25032508
auto hi = p.get_hi_pos();

0 commit comments

Comments
 (0)