about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/back
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2019-12-07 00:10:02 +0900
committerGitHub <noreply@github.com>2019-12-07 00:10:02 +0900
commit0b471bffc3a81a2b9f1c29debb53d2b3b6fbe117 (patch)
tree4af89cdedd758b2f68bd4e9f45ef0b3938bb6363 /src/librustc_codegen_llvm/back
parentfd4cec0303d2256e37f3e926e112aaa2d8b38a8b (diff)
parent16d21783d63c9ff89742ab83c2d02d25307c262c (diff)
Rollup merge of #67033 - cuviper:ValueName2, r=rkruppe
Migrate to LLVM{Get,Set}ValueName2

The deprecated `LLVM{Get,Set}ValueName` only work with NUL-terminated
strings, but the `2` variants use explicit lengths, which fits better
with Rust strings and slices. We now use these in new helper functions
`llvm::{get,set}_value_name` that convert to/from `&[u8]`.

Closes #64223.
r? @rkruppe
Diffstat (limited to 'src/librustc_codegen_llvm/back')
-rw-r--r--src/librustc_codegen_llvm/back/write.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs
index a05ba9c78e0..ada29c350ad 100644
--- a/src/librustc_codegen_llvm/back/write.rs
+++ b/src/librustc_codegen_llvm/back/write.rs
@@ -22,7 +22,7 @@ use rustc_fs_util::{path_to_c_string, link_or_copy};
 use rustc_data_structures::small_c_str::SmallCStr;
 use errors::{Handler, FatalError};
 
-use std::ffi::{CString, CStr};
+use std::ffi::CString;
 use std::fs;
 use std::io::{self, Write};
 use std::path::{Path, PathBuf};
@@ -833,8 +833,8 @@ fn create_msvc_imps(
             })
             .filter_map(|val| {
                 // Exclude some symbols that we know are not Rust symbols.
-                let name = CStr::from_ptr(llvm::LLVMGetValueName(val));
-                if ignored(name.to_bytes()) {
+                let name = llvm::get_value_name(val);
+                if ignored(name) {
                     None
                 } else {
                     Some((val, name))
@@ -842,7 +842,7 @@ fn create_msvc_imps(
             })
             .map(move |(val, name)| {
                 let mut imp_name = prefix.as_bytes().to_vec();
-                imp_name.extend(name.to_bytes());
+                imp_name.extend(name);
                 let imp_name = CString::new(imp_name).unwrap();
                 (imp_name, val)
             })