Skip to content

Commit ca0f997

Browse files
committed
Factor out a repeated config.no_integrated_as test.
1 parent a147cd0 commit ca0f997

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

src/librustc_codegen_llvm/back/write.rs

+25-23
Original file line numberDiff line numberDiff line change
@@ -749,29 +749,31 @@ pub(crate) unsafe fn codegen(
749749
})?;
750750
}
751751

752-
if config_emit_normal_obj && !config.no_integrated_as {
753-
let _timer = cgcx
754-
.prof
755-
.generic_activity_with_arg("LLVM_module_codegen_emit_obj", &module.name[..]);
756-
with_codegen(tm, llmod, config.no_builtins, |cpm| {
757-
write_output_file(
758-
diag_handler,
759-
tm,
760-
cpm,
761-
llmod,
762-
&obj_out,
763-
llvm::FileType::ObjectFile,
764-
)
765-
})?;
766-
} else if config_emit_normal_obj && config.no_integrated_as {
767-
let _timer = cgcx
768-
.prof
769-
.generic_activity_with_arg("LLVM_module_codegen_asm_to_obj", &module.name[..]);
770-
let assembly = cgcx.output_filenames.temp_path(OutputType::Assembly, module_name);
771-
run_assembler(cgcx, diag_handler, &assembly, &obj_out);
772-
773-
if !config.emit_asm && !cgcx.save_temps {
774-
drop(fs::remove_file(&assembly));
752+
if config_emit_normal_obj {
753+
if !config.no_integrated_as {
754+
let _timer = cgcx
755+
.prof
756+
.generic_activity_with_arg("LLVM_module_codegen_emit_obj", &module.name[..]);
757+
with_codegen(tm, llmod, config.no_builtins, |cpm| {
758+
write_output_file(
759+
diag_handler,
760+
tm,
761+
cpm,
762+
llmod,
763+
&obj_out,
764+
llvm::FileType::ObjectFile,
765+
)
766+
})?;
767+
} else {
768+
let _timer = cgcx
769+
.prof
770+
.generic_activity_with_arg("LLVM_module_codegen_asm_to_obj", &module.name[..]);
771+
let assembly = cgcx.output_filenames.temp_path(OutputType::Assembly, module_name);
772+
run_assembler(cgcx, diag_handler, &assembly, &obj_out);
773+
774+
if !config.emit_asm && !cgcx.save_temps {
775+
drop(fs::remove_file(&assembly));
776+
}
775777
}
776778
}
777779

0 commit comments

Comments
 (0)