mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-11 06:24:24 +00:00
Rollup merge of #93331 - pnkfelix:refactor-write-output-file, r=oli-obk
refactor write_output_file to merge two invocation paths into one. this is a trivial refactor I did while I was investigating issue #91671.
This commit is contained in:
commit
07771137eb
@ -56,28 +56,24 @@ pub fn write_output_file<'ll>(
|
||||
file_type: llvm::FileType,
|
||||
self_profiler_ref: &SelfProfilerRef,
|
||||
) -> Result<(), FatalError> {
|
||||
debug!("write_output_file output={:?} dwo_output={:?}", output, dwo_output);
|
||||
unsafe {
|
||||
let output_c = path_to_c_string(output);
|
||||
let result = if let Some(dwo_output) = dwo_output {
|
||||
let dwo_output_c = path_to_c_string(dwo_output);
|
||||
llvm::LLVMRustWriteOutputFile(
|
||||
target,
|
||||
pm,
|
||||
m,
|
||||
output_c.as_ptr(),
|
||||
dwo_output_c.as_ptr(),
|
||||
file_type,
|
||||
)
|
||||
let dwo_output_c;
|
||||
let dwo_output_ptr = if let Some(dwo_output) = dwo_output {
|
||||
dwo_output_c = path_to_c_string(dwo_output);
|
||||
dwo_output_c.as_ptr()
|
||||
} else {
|
||||
llvm::LLVMRustWriteOutputFile(
|
||||
target,
|
||||
pm,
|
||||
m,
|
||||
output_c.as_ptr(),
|
||||
std::ptr::null(),
|
||||
file_type,
|
||||
)
|
||||
std::ptr::null()
|
||||
};
|
||||
let result = llvm::LLVMRustWriteOutputFile(
|
||||
target,
|
||||
pm,
|
||||
m,
|
||||
output_c.as_ptr(),
|
||||
dwo_output_ptr,
|
||||
file_type,
|
||||
);
|
||||
|
||||
// Record artifact sizes for self-profiling
|
||||
if result == llvm::LLVMRustResult::Success {
|
||||
|
Loading…
Reference in New Issue
Block a user