about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/debuginfo
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2025-10-02 17:33:28 +1000
committerZalathar <Zalathar@users.noreply.github.com>2025-10-02 18:06:58 +1000
commit8ef9821bf2e27bf7ab4f9a0e3d0975dc59d3d932 (patch)
tree5cdceecd6fdb6b060c32ba39ce40672472e4c703 /compiler/rustc_codegen_llvm/src/debuginfo
parent6a58f80a3c4cf53f8092e75c07cebd5e913cccf0 (diff)
downloadrust-8ef9821bf2e27bf7ab4f9a0e3d0975dc59d3d932.tar.gz
rust-8ef9821bf2e27bf7ab4f9a0e3d0975dc59d3d932.zip
Extract helper method `global_set_metadata_node`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/debuginfo')
-rw-r--r--compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
index 6b2fe27425e..2f9e7cae54f 100644
--- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
+++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
@@ -1610,11 +1610,8 @@ pub(crate) fn apply_vcall_visibility_metadata<'ll, 'tcx>(
     let type_ = [llvm::LLVMValueAsMetadata(cx.const_usize(0)), typeid];
     cx.global_add_metadata_node(vtable, llvm::MD_type, &type_);
 
-    unsafe {
-        let vcall_visibility = llvm::LLVMValueAsMetadata(cx.const_u64(vcall_visibility as u64));
-        let vcall_visibility_metadata = llvm::LLVMMDNodeInContext2(cx.llcx, &vcall_visibility, 1);
-        llvm::LLVMGlobalSetMetadata(vtable, llvm::MD_vcall_visibility, vcall_visibility_metadata);
-    }
+    let vcall_visibility = [llvm::LLVMValueAsMetadata(cx.const_u64(vcall_visibility as u64))];
+    cx.global_set_metadata_node(vtable, llvm::MD_vcall_visibility, &vcall_visibility);
 }
 
 /// Creates debug information for the given vtable, which is for the