diff options
| author | Oli Scherer <github333195615777966@oli-obk.de> | 2025-02-24 14:33:55 +0000 |
|---|---|---|
| committer | Oli Scherer <github333195615777966@oli-obk.de> | 2025-02-24 15:11:29 +0000 |
| commit | f16f64b15a51789984d9014e92e86fb3a2fe8ce0 (patch) | |
| tree | 53cf9997b169497bbf3e9e4baa8f50fed8fe0166 /compiler/rustc_codegen_llvm/src/context.rs | |
| parent | 241c83f0c7877815b592a276bb13af57fbb8d7fc (diff) | |
| download | rust-f16f64b15a51789984d9014e92e86fb3a2fe8ce0.tar.gz rust-f16f64b15a51789984d9014e92e86fb3a2fe8ce0.zip | |
Remove inherent function that has a trait method duplicate of a commonly imported trait
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/context.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/context.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index c3f8f60eb5e..a4e88e5a23f 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -32,7 +32,7 @@ use smallvec::SmallVec; use crate::back::write::to_llvm_code_model; use crate::callee::get_fn; -use crate::common::{self, AsCCharPtr}; +use crate::common::AsCCharPtr; use crate::debuginfo::metadata::apply_vcall_visibility_metadata; use crate::llvm::{Metadata, MetadataType}; use crate::type_::Type; @@ -652,24 +652,22 @@ impl<'ll> SimpleCx<'ll> { let isize_ty = llvm::Type::ix_llcx(llcx, pointer_size.bits()); Self(SCx { llmod, llcx, isize_ty }, PhantomData) } +} - pub(crate) fn val_ty(&self, v: &'ll Value) -> &'ll Type { - common::val_ty(v) - } - +impl<'ll, CX: Borrow<SCx<'ll>>> GenericCx<'ll, CX> { pub(crate) fn get_metadata_value(&self, metadata: &'ll Metadata) -> &'ll Value { - unsafe { llvm::LLVMMetadataAsValue(self.llcx, metadata) } + unsafe { llvm::LLVMMetadataAsValue(self.llcx(), metadata) } } pub(crate) fn get_function(&self, name: &str) -> Option<&'ll Value> { let name = SmallCStr::new(name); - unsafe { llvm::LLVMGetNamedFunction(self.llmod, name.as_ptr()) } + unsafe { llvm::LLVMGetNamedFunction((**self).borrow().llmod, name.as_ptr()) } } pub(crate) fn get_md_kind_id(&self, name: &str) -> u32 { unsafe { llvm::LLVMGetMDKindIDInContext( - self.llcx, + self.llcx(), name.as_ptr() as *const c_char, name.len() as c_uint, ) @@ -678,7 +676,7 @@ impl<'ll> SimpleCx<'ll> { pub(crate) fn create_metadata(&self, name: String) -> Option<&'ll Metadata> { Some(unsafe { - llvm::LLVMMDStringInContext2(self.llcx, name.as_ptr() as *const c_char, name.len()) + llvm::LLVMMDStringInContext2(self.llcx(), name.as_ptr() as *const c_char, name.len()) }) } } |
