Skip to content

Commit f8261b4

Browse files
committed
Factor out a repeated config.obj_is_bitcode test.
1 parent e4b36ba commit f8261b4

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/librustc_codegen_llvm/back/write.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -773,17 +773,19 @@ pub(crate) unsafe fn codegen(
773773
}
774774
}
775775

776-
if config.emit_obj && config.obj_is_bitcode {
777-
debug!("copying bitcode {:?} to obj {:?}", bc_out, obj_out);
778-
if let Err(e) = link_or_copy(&bc_out, &obj_out) {
779-
diag_handler.err(&format!("failed to copy bitcode to object file: {}", e));
776+
if config.obj_is_bitcode {
777+
if config.emit_obj {
778+
debug!("copying bitcode {:?} to obj {:?}", bc_out, obj_out);
779+
if let Err(e) = link_or_copy(&bc_out, &obj_out) {
780+
diag_handler.err(&format!("failed to copy bitcode to object file: {}", e));
781+
}
780782
}
781-
}
782783

783-
if !config.emit_bc && config.obj_is_bitcode {
784-
debug!("removing_bitcode {:?}", bc_out);
785-
if let Err(e) = fs::remove_file(&bc_out) {
786-
diag_handler.err(&format!("failed to remove bitcode: {}", e));
784+
if !config.emit_bc {
785+
debug!("removing_bitcode {:?}", bc_out);
786+
if let Err(e) = fs::remove_file(&bc_out) {
787+
diag_handler.err(&format!("failed to remove bitcode: {}", e));
788+
}
787789
}
788790
}
789791

0 commit comments

Comments
 (0)