diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-10-03 09:16:27 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-03 09:16:27 +1000 |
| commit | 7a011558aa2be8b5049660727c8a0b661d21d0da (patch) | |
| tree | 1af292f807638dc27f1b514a57621f50d6f2423a /compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | |
| parent | 6fe05b5162fffb0d1d368d6c778b02872df1b5a4 (diff) | |
| parent | 8ef9821bf2e27bf7ab4f9a0e3d0975dc59d3d932 (diff) | |
| download | rust-7a011558aa2be8b5049660727c8a0b661d21d0da.tar.gz rust-7a011558aa2be8b5049660727c8a0b661d21d0da.zip | |
Rollup merge of #147259 - Zalathar:node-in-context, r=nnethercote
cg_llvm: Use helper methods for all calls to `LLVMMDNodeInContext2` Originally I was only planning on extracting an `md_node_in_context` method, but then I noticed that all callers of `LLVMMDNodeInContext2` could be covered by a small number of additional helper methods. There should be no change in compiler output.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs index bc20c759413..2f9e7cae54f 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs @@ -1607,17 +1607,11 @@ pub(crate) fn apply_vcall_visibility_metadata<'ll, 'tcx>( let trait_ref_typeid = typeid_for_trait_ref(cx.tcx, trait_ref); let typeid = cx.create_metadata(trait_ref_typeid.as_bytes()); - unsafe { - let v = [llvm::LLVMValueAsMetadata(cx.const_usize(0)), typeid]; - llvm::LLVMRustGlobalAddMetadata( - vtable, - llvm::MD_type, - llvm::LLVMMDNodeInContext2(cx.llcx, v.as_ptr(), v.len()), - ); - 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 type_ = [llvm::LLVMValueAsMetadata(cx.const_usize(0)), typeid]; + cx.global_add_metadata_node(vtable, llvm::MD_type, &type_); + + 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 |
