]> git.lizzy.rs Git - rust.git/commitdiff
Reuse cleanup pad declared at start of block.
authorMark Simulacrum <mark.simulacrum@gmail.com>
Tue, 20 Dec 2016 21:14:30 +0000 (14:14 -0700)
committerMark Simulacrum <mark.simulacrum@gmail.com>
Wed, 21 Dec 2016 03:04:46 +0000 (20:04 -0700)
src/librustc_trans/cleanup.rs

index 9409ac5f8e1c76623284eba44dc1e5fe29f0043b..add820748acfcd5325107a8292a73e5d9b3671d2 100644 (file)
@@ -59,11 +59,11 @@ fn get_landing_pad<'a>(&self, fcx: &FunctionContext<'a, 'tcx>) -> BasicBlockRef
         bcx.set_personality_fn(llpersonality);
 
         if base::wants_msvc_seh(fcx.ccx.sess()) {
-            // Insert cleanup instructions into the cleanup block
-            let funclet = Some(Funclet::new(bcx.cleanup_pad(None, &[])));
+            let pad = bcx.cleanup_pad(None, &[]);
+            let funclet = Some(Funclet::new(pad));
             self.trans(funclet.as_ref(), &bcx);
 
-            bcx.cleanup_ret(bcx.cleanup_pad(None, &[]), None);
+            bcx.cleanup_ret(pad, None);
         } else {
             // The landing pad return type (the type being propagated). Not sure
             // what this represents but it's determined by the personality