about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2024-11-08 18:51:30 +1100
committerGitHub <noreply@github.com>2024-11-08 18:51:30 +1100
commit3a48d801557a571c819ce62764ae2cc18605e5c8 (patch)
tree1e8c238dd9b0862f0744c6f9a90f7ee6e4e65536 /compiler/rustc_codegen_llvm/src/llvm/ffi.rs
parent758a904764f438ffe05337912a84d49c62021da5 (diff)
parent5bfa0b106e253e6f8ed93d4c4f44534ccbb13c85 (diff)
downloadrust-3a48d801557a571c819ce62764ae2cc18605e5c8.tar.gz
rust-3a48d801557a571c819ce62764ae2cc18605e5c8.zip
Rollup merge of #132590 - Zalathar:z-timings-stats, r=jieyouxu
Simplify FFI calls for `-Ztime-llvm-passes` and `-Zprint-codegen-stats`

The existing code for these unstable LLVM-infodump flags was jumping through hoops to pass an allocated C string across the FFI boundary, when it's much simpler to just write to a `&RustString` instead.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm/ffi.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm/ffi.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
index d99fbfb1632..8508f87c8d3 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
@@ -1765,11 +1765,13 @@ unsafe extern "C" {
     /// Returns a string describing the last error caused by an LLVMRust* call.
     pub fn LLVMRustGetLastError() -> *const c_char;
 
-    /// Print the pass timings since static dtors aren't picking them up.
-    pub fn LLVMRustPrintPassTimings(size: *const size_t) -> *const c_char;
+    /// Prints the timing information collected by `-Ztime-llvm-passes`.
+    #[expect(improper_ctypes)]
+    pub(crate) fn LLVMRustPrintPassTimings(OutStr: &RustString);
 
-    /// Print the statistics since static dtors aren't picking them up.
-    pub fn LLVMRustPrintStatistics(size: *const size_t) -> *const c_char;
+    /// Prints the statistics collected by `-Zprint-codegen-stats`.
+    #[expect(improper_ctypes)]
+    pub(crate) fn LLVMRustPrintStatistics(OutStr: &RustString);
 
     /// Prepares inline assembly.
     pub fn LLVMRustInlineAsm(