18
18
//! corresponds to a normal exit from a block (for example, an expression
19
19
//! completing evaluation successfully without panic).
20
20
21
- use llvm:: { BasicBlockRef , ValueRef } ;
21
+ use llvm:: BasicBlockRef ;
22
22
use base;
23
+ use adt:: MaybeSizedValue ;
23
24
use common:: { BlockAndBuilder , FunctionContext , Funclet } ;
24
25
use glue;
25
26
use type_:: Type ;
26
- use value:: Value ;
27
27
use rustc:: ty:: Ty ;
28
28
29
29
pub struct CleanupScope < ' tcx > {
@@ -36,7 +36,7 @@ pub struct CleanupScope<'tcx> {
36
36
37
37
#[ derive( Copy , Clone ) ]
38
38
pub struct DropValue < ' tcx > {
39
- val : ValueRef ,
39
+ val : MaybeSizedValue ,
40
40
ty : Ty < ' tcx > ,
41
41
skip_dtor : bool ,
42
42
}
@@ -94,16 +94,14 @@ impl<'tcx> DropValue<'tcx> {
94
94
95
95
impl < ' a , ' tcx > FunctionContext < ' a , ' tcx > {
96
96
/// 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 > {
98
98
if !self . ccx . shared ( ) . type_needs_drop ( ty) { return CleanupScope :: noop ( ) ; }
99
99
let drop = DropValue {
100
100
val : val,
101
101
ty : ty,
102
102
skip_dtor : false ,
103
103
} ;
104
104
105
- debug ! ( "schedule_drop_mem(val={:?}, ty={:?}) skip_dtor={}" , Value ( val) , ty, drop. skip_dtor) ;
106
-
107
105
CleanupScope :: new ( self , drop)
108
106
}
109
107
@@ -112,7 +110,8 @@ impl<'a, 'tcx> FunctionContext<'a, 'tcx> {
112
110
/// `ty`. The scheduled code handles extracting the discriminant
113
111
/// and dropping the contents associated with that variant
114
112
/// *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 > {
116
115
// `if` below could be "!contents_needs_drop"; skipping drop
117
116
// is just an optimization, so sound to be conservative.
118
117
if !self . ccx . shared ( ) . type_needs_drop ( ty) { return CleanupScope :: noop ( ) ; }
@@ -123,9 +122,6 @@ impl<'a, 'tcx> FunctionContext<'a, 'tcx> {
123
122
skip_dtor : true ,
124
123
} ;
125
124
126
- debug ! ( "schedule_drop_adt_contents(val={:?}, ty={:?}) skip_dtor={}" ,
127
- Value ( val) , ty, drop. skip_dtor) ;
128
-
129
125
CleanupScope :: new ( self , drop)
130
126
}
131
127
}
0 commit comments