about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-07-16 01:56:23 +0000
committerbors <bors@rust-lang.org>2023-07-16 01:56:23 +0000
commitffb9b61294b96c389d343a4c55b15400249d74e6 (patch)
tree0d4287a4dcad41d4de6707424ad0b21bec288ad6 /compiler/rustc_codegen_llvm/src/llvm/ffi.rs
parent2c718d12599ca00dc3957ec604cb3e87fe437124 (diff)
parent352d0315998c3691e811d8406ae7931143cf7a16 (diff)
downloadrust-ffb9b61294b96c389d343a4c55b15400249d74e6.tar.gz
rust-ffb9b61294b96c389d343a4c55b15400249d74e6.zip
Auto merge of #113430 - Zalathar:hash, r=b-naber
Remove `LLVMRustCoverageHashCString`

Coverage has two FFI functions for computing the hash of a byte string. One takes a ptr/len pair (`LLVMRustCoverageHashByteArray`), and the other takes a NUL-terminated C string (`LLVMRustCoverageHashCString`).

But on closer inspection, the C string version is unnecessary. The calling-side code converts a Rust `&str` into a `CString`, and the C++ code then immediately turns it back into a ptr/len string before actually hashing it. So we can just call the ptr/len version directly instead.

---

This PR also fixes a bug in the C++ declaration of `LLVMRustCoverageHashByteArray`. It should be `size_t`, since that's what is declared and passed on the Rust side, and it's what `StrRef`'s constructor expects to receive on the callee side.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm/ffi.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm/ffi.rs1
1 files changed, 0 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
index e1dfc1b2dd6..605f0154773 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
@@ -1916,7 +1916,6 @@ extern "C" {
     );
 
     pub fn LLVMRustCoverageCreatePGOFuncNameVar(F: &Value, FuncName: *const c_char) -> &Value;
-    pub fn LLVMRustCoverageHashCString(StrVal: *const c_char) -> u64;
     pub fn LLVMRustCoverageHashByteArray(Bytes: *const c_char, NumBytes: size_t) -> u64;
 
     #[allow(improper_ctypes)]