File tree Expand file tree Collapse file tree 3 files changed +9
-12
lines changed
src/librustc_codegen_llvm Expand file tree Collapse file tree 3 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -468,8 +468,7 @@ fn run_pass_manager(cgcx: &CodegenContext,
468468
469469 if config. verify_llvm_ir {
470470 let pass = llvm:: LLVMRustFindAndCreatePass ( "verify\0 " . as_ptr ( ) as * const _ ) ;
471- assert ! ( !pass. is_null( ) ) ;
472- llvm:: LLVMRustAddPass ( pm, pass) ;
471+ llvm:: LLVMRustAddPass ( pm, pass. unwrap ( ) ) ;
473472 }
474473
475474 // When optimizing for LTO we don't actually pass in `-O0`, but we force
@@ -503,8 +502,7 @@ fn run_pass_manager(cgcx: &CodegenContext,
503502
504503 if config. verify_llvm_ir {
505504 let pass = llvm:: LLVMRustFindAndCreatePass ( "verify\0 " . as_ptr ( ) as * const _ ) ;
506- assert ! ( !pass. is_null( ) ) ;
507- llvm:: LLVMRustAddPass ( pm, pass) ;
505+ llvm:: LLVMRustAddPass ( pm, pass. unwrap ( ) ) ;
508506 }
509507
510508 time_ext ( cgcx. time_passes , None , "LTO passes" , ||
Original file line number Diff line number Diff line change @@ -522,10 +522,10 @@ unsafe fn optimize(cgcx: &CodegenContext,
522522 // manager.
523523 let addpass = |pass_name : & str | {
524524 let pass_name = CString :: new ( pass_name) . unwrap ( ) ;
525- let pass = llvm:: LLVMRustFindAndCreatePass ( pass_name. as_ptr ( ) ) ;
526- if pass . is_null ( ) {
527- return false ;
528- }
525+ let pass = match llvm:: LLVMRustFindAndCreatePass ( pass_name. as_ptr ( ) ) {
526+ Some ( pass ) => pass ,
527+ None => return false ,
528+ } ;
529529 let pass_manager = match llvm:: LLVMRustPassKind ( pass) {
530530 llvm:: PassKind :: Function => fpm,
531531 llvm:: PassKind :: Module => mpm,
Original file line number Diff line number Diff line change @@ -397,7 +397,6 @@ extern { pub type ObjectFile; }
397397extern { pub type SectionIterator ; }
398398pub type SectionIteratorRef = * mut SectionIterator ;
399399extern { pub type Pass ; }
400- pub type PassRef = * mut Pass ;
401400extern { pub type TargetMachine ; }
402401pub type TargetMachineRef = * const TargetMachine ;
403402extern { pub type Archive ; }
@@ -1414,9 +1413,9 @@ extern "C" {
14141413 pub fn LLVMIsAConstantInt ( value_ref : & Value ) -> Option < & Value > ;
14151414 pub fn LLVMIsAConstantFP ( value_ref : & Value ) -> Option < & Value > ;
14161415
1417- pub fn LLVMRustPassKind ( Pass : PassRef ) -> PassKind ;
1418- pub fn LLVMRustFindAndCreatePass ( Pass : * const c_char ) -> PassRef ;
1419- pub fn LLVMRustAddPass ( PM : PassManagerRef , Pass : PassRef ) ;
1416+ pub fn LLVMRustPassKind ( Pass : & Pass ) -> PassKind ;
1417+ pub fn LLVMRustFindAndCreatePass ( Pass : * const c_char ) -> Option < & ' static mut Pass > ;
1418+ pub fn LLVMRustAddPass ( PM : PassManagerRef , Pass : & ' static mut Pass ) ;
14201419
14211420 pub fn LLVMRustHasFeature ( T : TargetMachineRef , s : * const c_char ) -> bool ;
14221421
You can’t perform that action at this time.
0 commit comments