Skip to content

Commit 115c933

Browse files
committed
---
yaml --- r: 44726 b: refs/heads/master c: 40ffaea h: refs/heads/master v: v3
1 parent 02748d2 commit 115c933

File tree

8 files changed

+21
-63
lines changed

8 files changed

+21
-63
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 046fc5e0b18921a55d19922865e5f65a98ab0f56
2+
refs/heads/master: 40ffaeaea8f434d59f5dffbe8fc7be958a625e03
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d9689399d091c3265f00434a69c551a61c28dc
55
refs/heads/try: ef355f6332f83371e4acf04fc4eb940ab41d78d3

trunk/AUTHORS.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ Josh Matthews <[email protected]>
9393
Joshua Clark <[email protected]>
9494
Joshua Wise <[email protected]>
9595
Jyun-Yan You <[email protected]>
96-
Kang Seonghoon <[email protected]>
9796
Kelly Wilson <[email protected]>
9897
Kevin Atkinson <[email protected]>
9998
Kevin Cantu <[email protected]>

trunk/src/etc/emacs/rust-mode.el

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,17 @@
6666
"trait" "struct" "fn" "enum"
6767
"impl"))
6868
(puthash word 'def table))
69-
(dolist (word '("again" "assert"
70-
"break"
71-
"copy"
72-
"do" "drop"
73-
"else" "export" "extern"
74-
"fail" "for"
75-
"if" "use"
76-
"let" "log" "loop"
77-
"move" "new"
78-
"pure" "pub" "priv"
79-
"ref" "return" "static"
80-
"unchecked" "unsafe"
81-
"while"))
69+
(dolist (word '("as" "break"
70+
"copy" "do" "drop" "else"
71+
"extern" "for" "if" "let" "log"
72+
"loop" "once" "priv" "pub" "pure"
73+
"ref" "return" "static" "unsafe" "use"
74+
"while" "while"
75+
"assert"
76+
"mut"))
8277
(puthash word t table))
8378
(puthash "match" 'alt table)
84-
(dolist (word '("true" "false")) (puthash word 'atom table))
79+
(dolist (word '("self" "true" "false")) (puthash word 'atom table))
8580
table))
8681
;; FIXME type-context keywords
8782

trunk/src/librustc/lib/llvm.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,12 +1379,7 @@ pub fn type_to_str_inner(names: @TypeNames, +outer0: &[TypeRef], ty: TypeRef)
13791379
type_to_str_inner(names, outer, out_ty)).to_managed();
13801380
}
13811381
Struct => {
1382-
let n_elts = llvm::LLVMCountStructElementTypes(ty) as uint;
1383-
let mut elts = vec::from_elem(n_elts, 0 as TypeRef);
1384-
if !elts.is_empty() {
1385-
llvm::LLVMGetStructElementTypes(
1386-
ty, ptr::to_mut_unsafe_ptr(&mut elts[0]));
1387-
}
1382+
let elts = struct_tys(ty);
13881383
// See [Note at-str]
13891384
return fmt!("{%s}", tys_str(names, outer, elts)).to_managed();
13901385
}
@@ -1445,17 +1440,16 @@ pub fn fn_ty_param_tys(fn_ty: TypeRef) -> ~[TypeRef] {
14451440
}
14461441
}
14471442

1448-
pub fn struct_element_types(struct_ty: TypeRef) -> ~[TypeRef] {
1443+
pub fn struct_tys(struct_ty: TypeRef) -> ~[TypeRef] {
14491444
unsafe {
1450-
let count = llvm::LLVMCountStructElementTypes(struct_ty);
1451-
let mut buf: ~[TypeRef] =
1452-
vec::from_elem(count as uint,
1453-
cast::transmute::<uint,TypeRef>(0));
1454-
if buf.len() > 0 {
1455-
llvm::LLVMGetStructElementTypes(
1456-
struct_ty, ptr::to_mut_unsafe_ptr(&mut buf[0]));
1445+
let n_elts = llvm::LLVMCountStructElementTypes(struct_ty) as uint;
1446+
if n_elts == 0 {
1447+
return ~[];
14571448
}
1458-
return buf;
1449+
let mut elts = vec::from_elem(n_elts, ptr::null());
1450+
llvm::LLVMGetStructElementTypes(
1451+
struct_ty, ptr::to_mut_unsafe_ptr(&mut elts[0]));
1452+
return elts;
14591453
}
14601454
}
14611455

trunk/src/librustc/middle/trans/base.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,11 +2171,6 @@ pub fn trans_mod(ccx: @CrateContext, m: ast::_mod) {
21712171
}
21722172
}
21732173
2174-
pub fn get_pair_fn_ty(llpairty: TypeRef) -> TypeRef {
2175-
// Bit of a kludge: pick the fn typeref out of the pair.
2176-
return struct_elt(llpairty, 0u);
2177-
}
2178-
21792174
pub fn register_fn(ccx: @CrateContext,
21802175
sp: span,
21812176
+path: path,

trunk/src/librustc/middle/trans/cabi_x86_64.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use lib::llvm::{llvm, TypeRef, ValueRef, Integer, Pointer, Float, Double};
1515
use lib::llvm::{Struct, Array, Attribute};
1616
use lib::llvm::{StructRetAttribute, ByValAttribute};
17+
use lib::llvm::struct_tys;
1718
use middle::trans::common::*;
1819
use middle::trans::cabi::*;
1920

@@ -65,19 +66,6 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
6566
return (off + a - 1u) / a * a;
6667
}
6768

68-
fn struct_tys(ty: TypeRef) -> ~[TypeRef] {
69-
unsafe {
70-
let n = llvm::LLVMCountStructElementTypes(ty);
71-
if (n == 0) {
72-
return ~[];
73-
}
74-
let mut elts = vec::from_elem(n as uint, ptr::null());
75-
llvm::LLVMGetStructElementTypes(ty,
76-
ptr::to_mut_unsafe_ptr(&mut elts[0]));
77-
return elts;
78-
}
79-
}
80-
8169
fn ty_align(ty: TypeRef) -> uint {
8270
unsafe {
8371
return match llvm::LLVMGetTypeKind(ty) {

trunk/src/librustc/middle/trans/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ pub fn trans_rtcall_or_lang_call_with_type_params(bcx: block,
380380
fty);
381381
let mut llfnty = type_of::type_of(callee.bcx.ccx(),
382382
substituted);
383-
llfnty = T_ptr(struct_elt(llfnty, 0));
383+
llfnty = lib::llvm::struct_tys(llfnty)[0];
384384
new_llval = PointerCast(callee.bcx, fn_data.llfn, llfnty);
385385
}
386386
_ => fail!()

trunk/src/librustc/middle/trans/common.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -647,19 +647,6 @@ pub fn val_str(tn: @TypeNames, v: ValueRef) -> @str {
647647
return ty_str(tn, val_ty(v));
648648
}
649649

650-
// Returns the nth element of the given LLVM structure type.
651-
pub fn struct_elt(llstructty: TypeRef, n: uint) -> TypeRef {
652-
unsafe {
653-
let elt_count = llvm::LLVMCountStructElementTypes(llstructty) as uint;
654-
assert (n < elt_count);
655-
let mut elt_tys = vec::from_elem(elt_count, T_nil());
656-
llvm::LLVMGetStructElementTypes(
657-
llstructty,
658-
ptr::to_mut_unsafe_ptr(&mut elt_tys[0]));
659-
return llvm::LLVMGetElementType(elt_tys[n]);
660-
}
661-
}
662-
663650
pub fn in_scope_cx(cx: block, f: &fn(&mut scope_info)) {
664651
let mut cur = cx;
665652
loop {

0 commit comments

Comments
 (0)