Skip to content

Commit

Permalink
Factor out a repeated config.obj_is_bitcode test.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Mar 22, 2020
1 parent e4b36ba commit f8261b4
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/librustc_codegen_llvm/back/write.rs
Expand Up @@ -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));
}
}
}

Expand Down

0 comments on commit f8261b4

Please sign in to comment.