Remove an unnecessary block scope.

This commit is contained in:
Nicholas Nethercote 2020-03-20 12:46:27 +11:00
parent 47c8f3f56b
commit e4b36baf54

View file

@ -686,7 +686,6 @@ pub(crate) unsafe fn codegen(
embed_bitcode(cgcx, llcx, llmod, None); embed_bitcode(cgcx, llcx, llmod, None);
} }
{
if config.emit_ir { if config.emit_ir {
let _timer = cgcx let _timer = cgcx
.prof .prof
@ -700,9 +699,8 @@ pub(crate) unsafe fn codegen(
output_ptr: *mut c_char, output_ptr: *mut c_char,
output_len: size_t, output_len: size_t,
) -> size_t { ) -> size_t {
let input = unsafe { let input =
slice::from_raw_parts(input_ptr as *const u8, input_len as usize) unsafe { slice::from_raw_parts(input_ptr as *const u8, input_len as usize) };
};
let input = match str::from_utf8(input) { let input = match str::from_utf8(input) {
Ok(s) => s, Ok(s) => s,
@ -745,14 +743,7 @@ pub(crate) unsafe fn codegen(
// module to produce the asm output // module to produce the asm output
let llmod = if config.emit_obj { llvm::LLVMCloneModule(llmod) } else { llmod }; let llmod = if config.emit_obj { llvm::LLVMCloneModule(llmod) } else { llmod };
with_codegen(tm, llmod, config.no_builtins, |cpm| { with_codegen(tm, llmod, config.no_builtins, |cpm| {
write_output_file( write_output_file(diag_handler, tm, cpm, llmod, &path, llvm::FileType::AssemblyFile)
diag_handler,
tm,
cpm,
llmod,
&path,
llvm::FileType::AssemblyFile,
)
})?; })?;
} }
@ -781,7 +772,6 @@ pub(crate) unsafe fn codegen(
drop(fs::remove_file(&assembly)); drop(fs::remove_file(&assembly));
} }
} }
}
if config.emit_obj && config.obj_is_bitcode { if config.emit_obj && config.obj_is_bitcode {
debug!("copying bitcode {:?} to obj {:?}", bc_out, obj_out); debug!("copying bitcode {:?} to obj {:?}", bc_out, obj_out);