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,
468
468
469
469
if config. verify_llvm_ir {
470
470
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 ( ) ) ;
473
472
}
474
473
475
474
// When optimizing for LTO we don't actually pass in `-O0`, but we force
@@ -503,8 +502,7 @@ fn run_pass_manager(cgcx: &CodegenContext,
503
502
504
503
if config. verify_llvm_ir {
505
504
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 ( ) ) ;
508
506
}
509
507
510
508
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,
522
522
// manager.
523
523
let addpass = |pass_name : & str | {
524
524
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
+ } ;
529
529
let pass_manager = match llvm:: LLVMRustPassKind ( pass) {
530
530
llvm:: PassKind :: Function => fpm,
531
531
llvm:: PassKind :: Module => mpm,
Original file line number Diff line number Diff line change @@ -397,7 +397,6 @@ extern { pub type ObjectFile; }
397
397
extern { pub type SectionIterator ; }
398
398
pub type SectionIteratorRef = * mut SectionIterator ;
399
399
extern { pub type Pass ; }
400
- pub type PassRef = * mut Pass ;
401
400
extern { pub type TargetMachine ; }
402
401
pub type TargetMachineRef = * const TargetMachine ;
403
402
extern { pub type Archive ; }
@@ -1414,9 +1413,9 @@ extern "C" {
1414
1413
pub fn LLVMIsAConstantInt ( value_ref : & Value ) -> Option < & Value > ;
1415
1414
pub fn LLVMIsAConstantFP ( value_ref : & Value ) -> Option < & Value > ;
1416
1415
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 ) ;
1420
1419
1421
1420
pub fn LLVMRustHasFeature ( T : TargetMachineRef , s : * const c_char ) -> bool ;
1422
1421
You can’t perform that action at this time.
0 commit comments