diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2022-01-26 10:26:43 -0500 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2022-06-09 13:10:25 -0400 |
| commit | 927de9431686f9e1363c7e555b55e64773f5da29 (patch) | |
| tree | 5cad6285d97c9b408e7e13214aecaf94d8fcd0ad /compiler/rustc_codegen_llvm/src/back | |
| parent | 09d52bc5d4260bac8b9a2ea8ac7a07c5c72906f1 (diff) | |
| download | rust-927de9431686f9e1363c7e555b55e64773f5da29.tar.gz rust-927de9431686f9e1363c7e555b55e64773f5da29.zip | |
refactor write_output_file to merge two invocation paths into one.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/back/write.rs | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index 99e30531c22..50f8949c897 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -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 { |
