diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-03-21 09:15:07 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2020-03-23 10:45:27 +1100 |
| commit | f8261b496d5c94bd8d6ad5dcce0cb5cc2e0e3fe5 (patch) | |
| tree | dc3382044525dfdaf2a3e36d223eea834e9edc21 | |
| parent | e4b36baf54f0799c744b3f30f5be425ef050ce8c (diff) | |
| download | rust-f8261b496d5c94bd8d6ad5dcce0cb5cc2e0e3fe5.tar.gz rust-f8261b496d5c94bd8d6ad5dcce0cb5cc2e0e3fe5.zip | |
Factor out a repeated `config.obj_is_bitcode` test.
| -rw-r--r-- | src/librustc_codegen_llvm/back/write.rs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index 2826de1e490..1df8ee6746d 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -773,17 +773,19 @@ pub(crate) unsafe fn codegen( } } - if config.emit_obj && config.obj_is_bitcode { - debug!("copying bitcode {:?} to obj {:?}", bc_out, obj_out); - if let Err(e) = link_or_copy(&bc_out, &obj_out) { - diag_handler.err(&format!("failed to copy bitcode to object file: {}", e)); + if config.obj_is_bitcode { + if config.emit_obj { + debug!("copying bitcode {:?} to obj {:?}", bc_out, obj_out); + if let Err(e) = link_or_copy(&bc_out, &obj_out) { + diag_handler.err(&format!("failed to copy bitcode to object file: {}", e)); + } } - } - if !config.emit_bc && config.obj_is_bitcode { - debug!("removing_bitcode {:?}", bc_out); - if let Err(e) = fs::remove_file(&bc_out) { - diag_handler.err(&format!("failed to remove bitcode: {}", e)); + if !config.emit_bc { + debug!("removing_bitcode {:?}", bc_out); + if let Err(e) = fs::remove_file(&bc_out) { + diag_handler.err(&format!("failed to remove bitcode: {}", e)); + } } } |
