]> git.lizzy.rs Git - rust.git/commitdiff
Inline get_funclet
authorMark Simulacrum <mark.simulacrum@gmail.com>
Sun, 18 Dec 2016 16:46:11 +0000 (09:46 -0700)
committerMark Simulacrum <mark.simulacrum@gmail.com>
Wed, 21 Dec 2016 03:03:31 +0000 (20:03 -0700)
src/librustc_trans/cleanup.rs

index ee02fe1d7f5cf0420f8153d5f518aea6255ee2d1..7ba36e457529e8ec27839e3c693a5a2cb71ff71c 100644 (file)
@@ -71,16 +71,6 @@ fn branch(&self, bcx: &BlockAndBuilder, to_llbb: BasicBlockRef) {
             }
         }
     }
-
-    fn get_funclet(&self, bcx: &BlockAndBuilder) -> Option<Funclet> {
-        match *self {
-            UnwindKind::CleanupPad(_) => {
-                let pad = bcx.cleanup_pad(None, &[]);
-                Funclet::msvc(pad)
-            },
-            UnwindKind::LandingPad => Funclet::gnu(),
-        }
-    }
 }
 
 impl PartialEq for UnwindKind {
@@ -212,7 +202,11 @@ fn get_landing_pad<'a>(fcx: &FunctionContext<'a, 'tcx>, drop_val: &DropValue<'tc
         let mut cleanup = fcx.build_new_block("clean_custom_");
 
         // Insert cleanup instructions into the cleanup block
-        drop_val.trans(val.get_funclet(&cleanup).as_ref(), &cleanup);
+        let funclet = match val {
+            UnwindKind::CleanupPad(_) => Funclet::msvc(cleanup.cleanup_pad(None, &[])),
+            UnwindKind::LandingPad => Funclet::gnu(),
+        };
+        drop_val.trans(funclet.as_ref(), &cleanup);
 
         // Insert instruction into cleanup block to branch to the exit
         val.branch(&mut cleanup, resume_bcx.llbb());