@@ -370,7 +370,7 @@ fn create_compile_unit(cx: @mut CrateContext) {
370
370
} } } } } } ;
371
371
}
372
372
373
- fn create_file ( cx : @ mut CrateContext , full_path : & str ) -> DIFile {
373
+ fn create_file ( cx : & mut CrateContext , full_path : & str ) -> DIFile {
374
374
match dbg_cx ( cx) . created_files . find_equiv ( & full_path) {
375
375
Some ( file_md) => return * file_md,
376
376
None => ( )
@@ -440,7 +440,7 @@ fn create_block(bcx: block) -> DILexicalBlock {
440
440
441
441
442
442
443
- fn create_basic_type ( cx : @ mut CrateContext , t : ty:: t , _span : span ) -> DIType {
443
+ fn create_basic_type ( cx : & mut CrateContext , t : ty:: t , _span : span ) -> DIType {
444
444
let ty_id = ty:: type_id ( t) ;
445
445
match dbg_cx ( cx) . created_types . find ( & ty_id) {
446
446
Some ( ty_md) => return * ty_md,
@@ -492,7 +492,7 @@ fn create_basic_type(cx: @mut CrateContext, t: ty::t, _span: span) -> DIType {
492
492
return ty_md;
493
493
}
494
494
495
- fn create_pointer_type ( cx : @ mut CrateContext , t : ty:: t , _span : span , pointee : DIType ) -> DIType {
495
+ fn create_pointer_type ( cx : & mut CrateContext , t : ty:: t , _span : span , pointee : DIType ) -> DIType {
496
496
let ( size, align) = size_and_align_of ( cx, t) ;
497
497
let name = ty_to_str ( cx. tcx , t) ;
498
498
let ptr_md = do as_c_str ( name) |name| { unsafe {
@@ -517,9 +517,9 @@ struct StructContext {
517
517
}
518
518
519
519
impl StructContext {
520
- fn new ( cx : & CrateContext , name : ~str , file : DIFile , line : uint ) -> ~ StructContext {
520
+ fn new ( cx : & CrateContext , name : ~str , file : DIFile , line : uint ) -> StructContext {
521
521
debug ! ( "StructContext::create: %s" , name) ;
522
- let scx = ~ StructContext {
522
+ return StructContext {
523
523
builder : DIB ( cx) ,
524
524
file : file,
525
525
name : name,
@@ -528,7 +528,6 @@ impl StructContext {
528
528
total_size : 0 ,
529
529
align : 1
530
530
} ;
531
- return scx;
532
531
}
533
532
534
533
fn add_member ( & mut self , name : & str , line : uint , size : uint , align : uint , ty : DIType ) {
@@ -569,17 +568,19 @@ impl StructContext {
569
568
// let size_with_alignment = self.get_total_size_with_alignment();
570
569
571
570
// if st.size != size_with_alignment {
572
- // ccx.sess.bug("StructContext(%s)::verify_against_struct_or_tuple_type: invalid type size. Expected = %u, actual = %u",
571
+ // ccx.sess.bug("StructContext(%s)::verify_against_struct_or_tuple_type:
572
+ // invalid type size. Expected = %u, actual = %u",
573
573
// st.size, size_with_alignment);
574
574
// }
575
575
576
576
// if st.align != self.align {
577
- // ccx.sess.bug("StructContext(%s)::verify_against_struct_or_tuple_type: invalid type alignment. Expected = %u, actual = %u",
577
+ // ccx.sess.bug("StructContext(%s)::verify_against_struct_or_tuple_type:
578
+ // invalid type alignment. Expected = %u, actual = %u",
578
579
// st.align, self.align);
579
580
// }
580
581
// },
581
- // _ => ccx.sess.bug(fmt!("StructContext(%s)::verify_against_struct_or_tuple_type: called with invalid type %?",
582
- // self.name, t))
582
+ // _ => ccx.sess.bug(fmt!("StructContext(%s)::verify_against_struct_or_tuple_type:
583
+ // called with invalid type %?", self.name, t))
583
584
// }
584
585
//}
585
586
@@ -613,14 +614,14 @@ impl StructContext {
613
614
}
614
615
}
615
616
616
- fn create_struct ( cx : @ mut CrateContext , struct_type : ty:: t , fields : ~[ ty:: field ] , span : span )
617
+ fn create_struct ( cx : & mut CrateContext , struct_type : ty:: t , fields : ~[ ty:: field ] , span : span )
617
618
-> DICompositeType {
618
619
debug ! ( "create_struct: %?" , ty:: get( struct_type) ) ;
619
620
620
621
let loc = span_start ( cx, span) ;
621
622
let file_md = create_file ( cx, loc. file . name ) ;
622
623
623
- let mut scx = StructContext :: new ( cx, ty_to_str ( cx. tcx , t ) , file_md, loc. line ) ;
624
+ let mut scx = StructContext :: new ( cx, ty_to_str ( cx. tcx , struct_type ) , file_md, loc. line ) ;
624
625
for fields. iter( ) . advance |field| {
625
626
let field_t = field. mt. ty;
626
627
let ty_md = create_ty( cx, field_t, span) ;
@@ -631,7 +632,7 @@ fn create_struct(cx: @mut CrateContext, struct_type: ty::t, fields: ~[ty::field]
631
632
}
632
633
633
634
// returns (void* type as a ValueRef, size in bytes, align in bytes)
634
- fn voidptr ( cx : @ mut CrateContext ) -> ( DIDerivedType , uint , uint ) {
635
+ fn voidptr ( cx : & mut CrateContext ) -> ( DIDerivedType , uint , uint ) {
635
636
let size = sys:: size_of :: < ValueRef > ( ) ;
636
637
let align = sys:: min_align_of :: < ValueRef > ( ) ;
637
638
let vp = do as_c_str ( "*void" ) |name| { unsafe {
@@ -645,7 +646,7 @@ fn voidptr(cx: @mut CrateContext) -> (DIDerivedType, uint, uint) {
645
646
return ( vp, size, align) ;
646
647
}
647
648
648
- fn create_tuple ( cx : @ mut CrateContext , tuple_type : ty:: t , elements : & [ ty:: t ] , span : span )
649
+ fn create_tuple ( cx : & mut CrateContext , tuple_type : ty:: t , elements : & [ ty:: t ] , span : span )
649
650
-> DICompositeType {
650
651
debug ! ( "create_tuple: %?" , ty:: get( tuple_type) ) ;
651
652
@@ -662,7 +663,7 @@ fn create_tuple(cx: @mut CrateContext, tuple_type: ty::t, elements: &[ty::t], sp
662
663
return scx. finalize ( ) ;
663
664
}
664
665
665
- fn create_boxed_type ( cx : @ mut CrateContext , contents : ty:: t ,
666
+ fn create_boxed_type ( cx : & mut CrateContext , contents : ty:: t ,
666
667
span : span , boxed : DIType ) -> DICompositeType {
667
668
debug ! ( "create_boxed_type: %?" , ty:: get( contents) ) ;
668
669
@@ -686,7 +687,7 @@ fn create_boxed_type(cx: @mut CrateContext, contents: ty::t,
686
687
return scx. finalize ( ) ;
687
688
}
688
689
689
- fn create_fixed_vec ( cx : @ mut CrateContext , _vec_t : ty:: t , elem_t : ty:: t ,
690
+ fn create_fixed_vec ( cx : & mut CrateContext , _vec_t : ty:: t , elem_t : ty:: t ,
690
691
len : uint , span : span ) -> DIType {
691
692
debug ! ( "create_fixed_vec: %?" , ty:: get( _vec_t) ) ;
692
693
@@ -708,7 +709,7 @@ fn create_fixed_vec(cx: @mut CrateContext, _vec_t: ty::t, elem_t: ty::t,
708
709
} ;
709
710
}
710
711
711
- fn create_boxed_vec ( cx : @ mut CrateContext , vec_t : ty:: t , elem_t : ty:: t ,
712
+ fn create_boxed_vec ( cx : & mut CrateContext , vec_t : ty:: t , elem_t : ty:: t ,
712
713
vec_ty_span : span ) -> DICompositeType {
713
714
debug ! ( "create_boxed_vec: %?" , ty:: get( vec_t) ) ;
714
715
@@ -778,7 +779,7 @@ fn create_boxed_vec(cx: @mut CrateContext, vec_t: ty::t, elem_t: ty::t,
778
779
return mdval;
779
780
}
780
781
781
- fn create_vec_slice ( cx : @ mut CrateContext , vec_t : ty:: t , elem_t : ty:: t , span : span )
782
+ fn create_vec_slice ( cx : & mut CrateContext , vec_t : ty:: t , elem_t : ty:: t , span : span )
782
783
-> DICompositeType {
783
784
debug ! ( "create_vec_slice: %?" , ty:: get( vec_t) ) ;
784
785
@@ -795,7 +796,7 @@ fn create_vec_slice(cx: @mut CrateContext, vec_t: ty::t, elem_t: ty::t, span: sp
795
796
return scx. finalize ( ) ;
796
797
}
797
798
798
- fn create_fn_ty ( cx : @ mut CrateContext , _fn_ty : ty:: t , inputs : ~[ ty:: t ] , output : ty:: t ,
799
+ fn create_fn_ty ( cx : & mut CrateContext , _fn_ty : ty:: t , inputs : ~[ ty:: t ] , output : ty:: t ,
799
800
span : span ) -> DICompositeType {
800
801
debug ! ( "create_fn_ty: %?" , ty:: get( _fn_ty) ) ;
801
802
@@ -815,7 +816,7 @@ fn create_fn_ty(cx: @mut CrateContext, _fn_ty: ty::t, inputs: ~[ty::t], output:
815
816
} ;
816
817
}
817
818
818
- fn create_unimpl_ty ( cx : @ mut CrateContext , t : ty:: t ) -> DIType {
819
+ fn create_unimpl_ty ( cx : & mut CrateContext , t : ty:: t ) -> DIType {
819
820
debug ! ( "create_unimpl_ty: %?" , ty:: get( t) ) ;
820
821
821
822
let name = ty_to_str ( cx. tcx , t) ;
@@ -830,7 +831,7 @@ fn create_unimpl_ty(cx: @mut CrateContext, t: ty::t) -> DIType {
830
831
return md;
831
832
}
832
833
833
- fn create_ty ( cx : @ mut CrateContext , t : ty:: t , span : span ) -> DIType {
834
+ fn create_ty ( cx : & mut CrateContext , t : ty:: t , span : span ) -> DIType {
834
835
let ty_id = ty:: type_id ( t) ;
835
836
match dbg_cx ( cx) . created_types . find ( & ty_id) {
836
837
Some ( ty_md) => return * ty_md,
@@ -951,7 +952,7 @@ fn span_start(cx: &CrateContext, span: span) -> codemap::Loc {
951
952
cx. sess . codemap . lookup_char_pos ( span. lo )
952
953
}
953
954
954
- fn size_and_align_of ( cx : @ mut CrateContext , t : ty:: t ) -> ( uint , uint ) {
955
+ fn size_and_align_of ( cx : & mut CrateContext , t : ty:: t ) -> ( uint , uint ) {
955
956
let llty = type_of:: type_of ( cx, t) ;
956
957
( machine:: llsize_of_real ( cx, llty) , machine:: llalign_of_min ( cx, llty) )
957
958
}
0 commit comments