1818//! corresponds to a normal exit from a block (for example, an expression
1919//! completing evaluation successfully without panic).
2020
21- use llvm:: { BasicBlockRef , ValueRef } ;
21+ use llvm:: BasicBlockRef ;
2222use base;
23+ use adt:: MaybeSizedValue ;
2324use common:: { BlockAndBuilder , FunctionContext , Funclet } ;
2425use glue;
2526use type_:: Type ;
26- use value:: Value ;
2727use rustc:: ty:: Ty ;
2828
2929pub struct CleanupScope < ' tcx > {
@@ -36,7 +36,7 @@ pub struct CleanupScope<'tcx> {
3636
3737#[ derive( Copy , Clone ) ]
3838pub struct DropValue < ' tcx > {
39- val : ValueRef ,
39+ val : MaybeSizedValue ,
4040 ty : Ty < ' tcx > ,
4141 skip_dtor : bool ,
4242}
@@ -94,16 +94,14 @@ impl<'tcx> DropValue<'tcx> {
9494
9595impl < ' a , ' tcx > FunctionContext < ' a , ' tcx > {
9696 /// Schedules a (deep) drop of `val`, which is a pointer to an instance of `ty`
97- pub fn schedule_drop_mem ( & self , val : ValueRef , ty : Ty < ' tcx > ) -> CleanupScope < ' tcx > {
97+ pub fn schedule_drop_mem ( & self , val : MaybeSizedValue , ty : Ty < ' tcx > ) -> CleanupScope < ' tcx > {
9898 if !self . ccx . shared ( ) . type_needs_drop ( ty) { return CleanupScope :: noop ( ) ; }
9999 let drop = DropValue {
100100 val : val,
101101 ty : ty,
102102 skip_dtor : false ,
103103 } ;
104104
105- debug ! ( "schedule_drop_mem(val={:?}, ty={:?}) skip_dtor={}" , Value ( val) , ty, drop. skip_dtor) ;
106-
107105 CleanupScope :: new ( self , drop)
108106 }
109107
@@ -112,7 +110,8 @@ impl<'a, 'tcx> FunctionContext<'a, 'tcx> {
112110 /// `ty`. The scheduled code handles extracting the discriminant
113111 /// and dropping the contents associated with that variant
114112 /// *without* executing any associated drop implementation.
115- pub fn schedule_drop_adt_contents ( & self , val : ValueRef , ty : Ty < ' tcx > ) -> CleanupScope < ' tcx > {
113+ pub fn schedule_drop_adt_contents ( & self , val : MaybeSizedValue , ty : Ty < ' tcx > )
114+ -> CleanupScope < ' tcx > {
116115 // `if` below could be "!contents_needs_drop"; skipping drop
117116 // is just an optimization, so sound to be conservative.
118117 if !self . ccx . shared ( ) . type_needs_drop ( ty) { return CleanupScope :: noop ( ) ; }
@@ -123,9 +122,6 @@ impl<'a, 'tcx> FunctionContext<'a, 'tcx> {
123122 skip_dtor : true ,
124123 } ;
125124
126- debug ! ( "schedule_drop_adt_contents(val={:?}, ty={:?}) skip_dtor={}" ,
127- Value ( val) , ty, drop. skip_dtor) ;
128-
129125 CleanupScope :: new ( self , drop)
130126 }
131127}
0 commit comments