Skip to content

Commit dc5905e

Browse files
committed
---
yaml --- r: 6844 b: refs/heads/master c: abbd86f h: refs/heads/master v: v3
1 parent d4a9ae6 commit dc5905e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1384
-343
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: e1a9668ab27805db83f97cafe2a937e6569863ff
2+
refs/heads/master: abbd86f1e6dc9cf33bc5f4c3b1c90c680072d0c4

trunk/mk/target.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ $$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X): \
5050
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
5151
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM) \
5252
$$(TCORELIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
53-
$$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3)) \
54-
$$(TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3))
53+
$$(TSTDLIB_DEFAULT$(1)_T_$(2)_H_$(3))
5554
@$$(call E, compile_and_link: $$@)
5655
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$<
5756

trunk/src/comp/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ mod write {
321321
*
322322
* There are a few issues to handle:
323323
*
324-
* - Linnkers operate on a flat namespace, so we have to flatten names.
324+
* - Linkers operate on a flat namespace, so we have to flatten names.
325325
* We do this using the C++ namespace-mangling technique. Foo::bar
326326
* symbols and such.
327327
*

trunk/src/comp/driver/rustc.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import syntax::print::{pp, pprust};
1111
import util::{ppaux, filesearch};
1212
import back::link;
1313
import core::{option, str, vec, int, result};
14+
import result::{ok, err};
1415
import std::{fs, io, getopts};
1516
import option::{some, none};
1617
import getopts::{optopt, optmulti, optflag, optflagopt, opt_present};
@@ -420,7 +421,8 @@ fn build_session_options(match: getopts::match)
420421
let libcore = !opt_present(match, "no-core");
421422
let verify = !opt_present(match, "no-verify");
422423
let save_temps = opt_present(match, "save-temps");
423-
let debuginfo = opt_present(match, "g");
424+
let extra_debuginfo = opt_present(match, "xg");
425+
let debuginfo = opt_present(match, "g") || extra_debuginfo;
424426
let stats = opt_present(match, "stats");
425427
let time_passes = opt_present(match, "time-passes");
426428
let time_llvm_passes = opt_present(match, "time-llvm-passes");
@@ -467,6 +469,7 @@ fn build_session_options(match: getopts::match)
467469
libcore: libcore,
468470
optimize: opt_level,
469471
debuginfo: debuginfo,
472+
extra_debuginfo: extra_debuginfo,
470473
verify: verify,
471474
save_temps: save_temps,
472475
stats: stats,
@@ -486,7 +489,7 @@ fn build_session_options(match: getopts::match)
486489
ret sopts;
487490
}
488491

489-
fn build_session(sopts: @session::options) -> session::session {
492+
fn build_session(sopts: @session::options, input: str) -> session::session {
490493
let target_cfg = build_target_config(sopts);
491494
let cstore = cstore::mk_cstore();
492495
let filesearch = filesearch::mk_filesearch(
@@ -495,7 +498,7 @@ fn build_session(sopts: @session::options) -> session::session {
495498
sopts.addl_lib_search_paths);
496499
ret session::session(target_cfg, sopts, cstore,
497500
@{cm: codemap::new_codemap(), mutable next_id: 1},
498-
none, 0u, filesearch, false);
501+
none, 0u, filesearch, false, fs::dirname(input));
499502
}
500503

501504
fn parse_pretty(sess: session::session, &&name: str) -> pp_mode {
@@ -515,7 +518,7 @@ fn opts() -> [getopts::opt] {
515518
optflag("emit-llvm"), optflagopt("pretty"),
516519
optflag("ls"), optflag("parse-only"), optflag("no-trans"),
517520
optflag("O"), optopt("opt-level"), optmulti("L"), optflag("S"),
518-
optopt("o"), optopt("out-dir"),
521+
optopt("o"), optopt("out-dir"), optflag("xg"),
519522
optflag("c"), optflag("g"), optflag("save-temps"),
520523
optopt("sysroot"), optopt("target"), optflag("stats"),
521524
optflag("time-passes"), optflag("time-llvm-passes"),
@@ -621,8 +624,8 @@ fn main(args: [str]) {
621624
let args = args, binary = vec::shift(args);
622625
let match =
623626
alt getopts::getopts(args, opts()) {
624-
getopts::success(m) { m }
625-
getopts::failure(f) {
627+
ok(m) { m }
628+
err(f) {
626629
early_error(getopts::fail_str(f))
627630
}
628631
};
@@ -641,7 +644,7 @@ fn main(args: [str]) {
641644
};
642645

643646
let sopts = build_session_options(match);
644-
let sess = build_session(sopts);
647+
let sess = build_session(sopts, ifile);
645648
let odir = getopts::opt_maybe_str(match, "out-dir");
646649
let ofile = getopts::opt_maybe_str(match, "o");
647650
let cfg = build_configuration(sess, binary, ifile);
@@ -670,10 +673,10 @@ mod test {
670673
fn test_switch_implies_cfg_test() {
671674
let match =
672675
alt getopts::getopts(["--test"], opts()) {
673-
getopts::success(m) { m }
676+
ok(m) { m }
674677
};
675678
let sessopts = build_session_options(match);
676-
let sess = build_session(sessopts);
679+
let sess = build_session(sessopts, "");
677680
let cfg = build_configuration(sess, "whatever", "whatever");
678681
assert (attr::contains_name(cfg, "test"));
679682
}
@@ -684,10 +687,10 @@ mod test {
684687
fn test_switch_implies_cfg_test_unless_cfg_test() {
685688
let match =
686689
alt getopts::getopts(["--test", "--cfg=test"], opts()) {
687-
getopts::success(m) { m }
690+
ok(m) { m }
688691
};
689692
let sessopts = build_session_options(match);
690-
let sess = build_session(sessopts);
693+
let sess = build_session(sessopts, "");
691694
let cfg = build_configuration(sess, "whatever", "whatever");
692695
let test_items = attr::find_meta_items_by_name(cfg, "test");
693696
assert (vec::len(test_items) == 1u);

trunk/src/comp/driver/session.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type options =
3131
libcore: bool,
3232
optimize: uint,
3333
debuginfo: bool,
34+
extra_debuginfo: bool,
3435
verify: bool,
3536
save_temps: bool,
3637
stats: bool,
@@ -59,7 +60,8 @@ obj session(targ_cfg: @config,
5960
mutable main_fn: option::t<node_id>,
6061
mutable err_count: uint,
6162
filesearch: filesearch::filesearch,
62-
mutable building_library: bool) {
63+
mutable building_library: bool,
64+
working_dir: str) {
6365
fn get_targ_cfg() -> @config { ret targ_cfg; }
6466
fn get_opts() -> @options { ret opts; }
6567
fn get_cstore() -> metadata::cstore::cstore { cstore }
@@ -122,6 +124,9 @@ obj session(targ_cfg: @config,
122124
fn set_building_library(crate: @ast::crate) {
123125
building_library = session::building_library(opts.crate_type, crate);
124126
}
127+
fn get_working_dir() -> str {
128+
ret working_dir;
129+
}
125130
}
126131

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

trunk/src/comp/lib/llvm.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,11 @@ native mod llvm {
234234
/* Operations on other types */
235235
fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
236236
fn LLVMLabelTypeInContext(C: ContextRef) -> TypeRef;
237+
fn LLVMMetadataTypeInContext(C: ContextRef) -> TypeRef;
237238

238239
fn LLVMVoidType() -> TypeRef;
239240
fn LLVMLabelType() -> TypeRef;
241+
fn LLVMMetadataType() -> TypeRef;
240242

241243
/* Operations on all values */
242244
fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
@@ -256,6 +258,7 @@ native mod llvm {
256258

257259
/* Operations on Users */
258260
fn LLVMGetOperand(Val: ValueRef, Index: uint) -> ValueRef;
261+
fn LLVMSetOperand(Val: ValueRef, Index: uint, Op: ValueRef);
259262

260263
/* Operations on constants of any type */
261264
fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
@@ -275,6 +278,8 @@ native mod llvm {
275278
fn LLVMMDNodeInContext(C: ContextRef, Vals: *ValueRef, Count: uint) ->
276279
ValueRef;
277280
fn LLVMMDNode(Vals: *ValueRef, Count: uint) -> ValueRef;
281+
fn LLVMAddNamedMetadataOperand(M: ModuleRef, Str: sbuf, SLen: uint,
282+
Val: ValueRef);
278283

279284
/* Operations on scalar constants */
280285
fn LLVMConstInt(IntTy: TypeRef, N: ULongLong, SignExtend: Bool) ->

trunk/src/comp/metadata/decoder.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,12 @@ fn item_type(item: ebml::doc, this_cnum: ast::crate_num, tcx: ty::ctxt,
107107
}
108108
let tp = ebml::get_doc(item, tag_items_data_item_type);
109109
let def_parser = bind parse_external_def_id(this_cnum, extres, _);
110-
ret parse_ty_data(item.data, this_cnum, tp.start, tp.end - tp.start,
111-
def_parser, tcx);
110+
let t = parse_ty_data(item.data, this_cnum, tp.start, tp.end - tp.start,
111+
def_parser, tcx);
112+
if family_names_type(item_family(item)) {
113+
t = ty::mk_named(tcx, t, @item_name(item));
114+
}
115+
t
112116
}
113117

114118
fn item_ty_param_kinds(item: ebml::doc) -> [ast::kind] {
@@ -307,6 +311,10 @@ fn family_has_type_params(fam_ch: u8) -> bool {
307311
};
308312
}
309313

314+
fn family_names_type(fam_ch: u8) -> bool {
315+
alt fam_ch as char { 'y' | 't' { true } _ { false } }
316+
}
317+
310318
fn read_path(d: ebml::doc) -> {path: str, pos: uint} {
311319
let desc = ebml::doc_data(d);
312320
let pos = ebml::be_uint_from_bytes(@desc, 0u, 4u);

trunk/src/comp/metadata/encoder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
314314
encode_family(ebml_w, 'y' as u8);
315315
encode_type_param_kinds(ebml_w, tps);
316316
encode_type(ecx, ebml_w, node_id_to_monotype(ecx.ccx.tcx, item.id));
317+
encode_name(ebml_w, item.ident);
317318
ebml::end_tag(ebml_w);
318319
}
319320
item_tag(variants, tps) {
@@ -322,6 +323,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
322323
encode_family(ebml_w, 't' as u8);
323324
encode_type_param_kinds(ebml_w, tps);
324325
encode_type(ecx, ebml_w, node_id_to_monotype(ecx.ccx.tcx, item.id));
326+
encode_name(ebml_w, item.ident);
325327
for v: variant in variants {
326328
encode_variant_id(ebml_w, local_def(v.node.id));
327329
}
@@ -336,6 +338,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
336338
encode_family(ebml_w, 'y' as u8);
337339
encode_type_param_kinds(ebml_w, tps);
338340
encode_type(ecx, ebml_w, ty::ty_fn_ret(ecx.ccx.tcx, fn_ty));
341+
encode_name(ebml_w, item.ident);
339342
encode_symbol(ecx, ebml_w, item.id);
340343
ebml::end_tag(ebml_w);
341344

@@ -356,6 +359,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
356359
encode_family(ebml_w, 'y' as u8);
357360
encode_type_param_kinds(ebml_w, tps);
358361
encode_type(ecx, ebml_w, ty::ty_fn_ret(ecx.ccx.tcx, fn_ty));
362+
encode_name(ebml_w, item.ident);
359363
ebml::end_tag(ebml_w);
360364

361365
index += [{val: ctor_id, pos: ebml_w.writer.tell()}];

trunk/src/comp/middle/ast_map.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import syntax::{visit, codemap};
77
tag ast_node {
88
node_item(@item);
99
node_obj_ctor(@item);
10+
node_obj_method(@method);
1011
node_native_item(@native_item);
1112
node_method(@method);
1213
node_expr(@expr);
1314
// Locals are numbered, because the alias analysis needs to know in which
1415
// order they are introduced.
1516
node_arg(arg, uint);
1617
node_local(uint);
18+
node_res_ctor(@item);
1719
}
1820

1921
type map = std::map::hashmap<node_id, ast_node>;
@@ -63,10 +65,19 @@ fn map_arm(cx: ctx, arm: arm) {
6365
fn map_item(cx: ctx, i: @item) {
6466
cx.map.insert(i.id, node_item(i));
6567
alt i.node {
66-
item_obj(_, _, ctor_id) { cx.map.insert(ctor_id, node_obj_ctor(i)); }
68+
item_obj(ob, _, ctor_id) {
69+
cx.map.insert(ctor_id, node_obj_ctor(i));
70+
for m in ob.methods {
71+
cx.map.insert(m.node.id, node_obj_method(m));
72+
}
73+
}
6774
item_impl(_, _, ms) {
6875
for m in ms { cx.map.insert(m.node.id, node_method(m)); }
6976
}
77+
item_res(_, dtor_id, _, ctor_id) {
78+
cx.map.insert(ctor_id, node_res_ctor(i));
79+
cx.map.insert(dtor_id, node_item(i));
80+
}
7081
_ { }
7182
}
7283
}

0 commit comments

Comments
 (0)