@@ -119,13 +119,16 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
119119 if let Some ( unwind) = unwind {
120120 let uwbcx = self . bcx ( unwind) ;
121121 let unwind = self . make_landing_pad ( uwbcx) ;
122+ let bundle = bcx. lpad ( ) . and_then ( |b| b. bundle ( ) ) ;
122123 bcx. invoke ( drop_fn,
123124 & [ llvalue] ,
124125 self . llblock ( target) ,
125126 unwind. llbb ( ) ,
127+ bundle,
126128 None ) ;
127129 } else {
128- bcx. call ( drop_fn, & [ llvalue] , None ) ;
130+ let bundle = bcx. lpad ( ) . and_then ( |b| b. bundle ( ) ) ;
131+ bcx. call ( drop_fn, & [ llvalue] , bundle, None ) ;
129132 bcx. br ( self . llblock ( target) ) ;
130133 }
131134 }
@@ -187,24 +190,28 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
187190 let cleanup = self . bcx ( cleanup) ;
188191 let landingpad = self . make_landing_pad ( cleanup) ;
189192 let unreachable_blk = self . unreachable_block ( ) ;
193+ let bundle = bcx. lpad ( ) . and_then ( |b| b. bundle ( ) ) ;
190194 bcx. invoke ( callee. immediate ( ) ,
191195 & llargs[ ..] ,
192196 unreachable_blk. llbb ,
193197 landingpad. llbb ( ) ,
198+ bundle,
194199 Some ( attrs) ) ;
195200 } ,
196201 ( false , false , & Some ( cleanup) , & Some ( ( _, success) ) ) => {
197202 let cleanup = self . bcx ( cleanup) ;
198203 let landingpad = self . make_landing_pad ( cleanup) ;
199204 let ( target, postinvoke) = if must_copy_dest {
200- ( bcx. fcx ( ) . new_block ( "" , None ) , Some ( self . bcx ( success) ) )
205+ ( bcx. fcx ( ) . new_block ( "" , None , None ) . build ( ) , Some ( self . bcx ( success) ) )
201206 } else {
202207 ( self . bcx ( success) , None )
203208 } ;
209+ let bundle = bcx. lpad ( ) . and_then ( |b| b. bundle ( ) ) ;
204210 let invokeret = bcx. invoke ( callee. immediate ( ) ,
205211 & llargs[ ..] ,
206212 target. llbb ( ) ,
207213 landingpad. llbb ( ) ,
214+ bundle,
208215 Some ( attrs) ) ;
209216 if let Some ( postinvoketarget) = postinvoke {
210217 // We translate the copy into a temporary block. The temporary block is
@@ -240,7 +247,8 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
240247 }
241248 } ,
242249 ( false , _, _, & None ) => {
243- bcx. call ( callee. immediate ( ) , & llargs[ ..] , Some ( attrs) ) ;
250+ let bundle = bcx. lpad ( ) . and_then ( |b| b. bundle ( ) ) ;
251+ bcx. call ( callee. immediate ( ) , & llargs[ ..] , bundle, Some ( attrs) ) ;
244252 bcx. unreachable ( ) ;
245253 }
246254 ( false , _, _, & Some ( ( _, target) ) ) => {
@@ -301,26 +309,25 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
301309 cleanup : BlockAndBuilder < ' bcx , ' tcx > )
302310 -> BlockAndBuilder < ' bcx , ' tcx >
303311 {
312+ let cleanup_llbb = cleanup. llbb ( ) ;
304313 let bcx = cleanup. map_block ( |cleanup| {
305- cleanup. fcx . new_block ( "cleanup" , None )
314+ // FIXME(#30941) this doesn't handle msvc-style exceptions
315+ cleanup. fcx . new_block ( "cleanup" , None , Some ( LandingPad :: gnu ( ) ) )
306316 } ) ;
307- // FIXME(#30941) this doesn't handle msvc-style exceptions
308- * bcx. lpad . borrow_mut ( ) = Some ( LandingPad :: gnu ( ) ) ;
309- let bcx = bcx. build ( ) ;
310317 let ccx = bcx. ccx ( ) ;
311318 let llpersonality = bcx. fcx ( ) . eh_personality ( ) ;
312319 let llretty = Type :: struct_ ( ccx, & [ Type :: i8p ( ccx) , Type :: i32 ( ccx) ] , false ) ;
313320 let llretval = bcx. landing_pad ( llretty, llpersonality, 1 , bcx. fcx ( ) . llfn ) ;
314321 bcx. set_cleanup ( llretval) ;
315322 let slot = self . get_personality_slot ( & bcx) ;
316323 bcx. store ( llretval, slot) ;
317- bcx. br ( cleanup . llbb ( ) ) ;
324+ bcx. br ( cleanup_llbb ) ;
318325 bcx
319326 }
320327
321328 fn unreachable_block ( & mut self ) -> Block < ' bcx , ' tcx > {
322329 self . unreachable_block . unwrap_or_else ( || {
323- let bl = self . fcx . new_block ( "unreachable" , None ) ;
330+ let bl = self . fcx . new_block ( "unreachable" , None , None ) ;
324331 bl. build ( ) . unreachable ( ) ;
325332 self . unreachable_block = Some ( bl) ;
326333 bl
0 commit comments