diff options
| author | Laurențiu Nicola <lnicola@users.noreply.github.com> | 2024-11-01 12:26:18 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-01 12:26:18 +0000 |
| commit | cf6bc48353ba46fceb43f5efc37858c471d05bb7 (patch) | |
| tree | 0cff0055f2ed9e9d18df92e2d98f10d7b5359075 /compiler/rustc_codegen_llvm/src/declare.rs | |
| parent | a5b5b466b0517124e8c5d8610d708aa04a1c4fc7 (diff) | |
| parent | 9acf57c48e0d55e7b2d07dae2bb4fbfc3fc010dd (diff) | |
| download | rust-cf6bc48353ba46fceb43f5efc37858c471d05bb7.tar.gz rust-cf6bc48353ba46fceb43f5efc37858c471d05bb7.zip | |
Merge pull request #18457 from lnicola/sync-from-rust
minor: Sync from downstream
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/declare.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/declare.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/declare.rs b/compiler/rustc_codegen_llvm/src/declare.rs index 33258cb46fa..d338c848754 100644 --- a/compiler/rustc_codegen_llvm/src/declare.rs +++ b/compiler/rustc_codegen_llvm/src/declare.rs @@ -20,6 +20,7 @@ use smallvec::SmallVec; use tracing::debug; use crate::abi::{FnAbi, FnAbiLlvmExt}; +use crate::common::AsCCharPtr; use crate::context::CodegenCx; use crate::llvm::AttributePlace::Function; use crate::llvm::Visibility; @@ -41,7 +42,7 @@ fn declare_raw_fn<'ll>( ) -> &'ll Value { debug!("declare_raw_fn(name={:?}, ty={:?})", name, ty); let llfn = unsafe { - llvm::LLVMRustGetOrInsertFunction(cx.llmod, name.as_ptr().cast(), name.len(), ty) + llvm::LLVMRustGetOrInsertFunction(cx.llmod, name.as_c_char_ptr(), name.len(), ty) }; llvm::SetFunctionCallConv(llfn, callconv); @@ -68,7 +69,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { /// return its Value instead. pub(crate) fn declare_global(&self, name: &str, ty: &'ll Type) -> &'ll Value { debug!("declare_global(name={:?})", name); - unsafe { llvm::LLVMRustGetOrInsertGlobal(self.llmod, name.as_ptr().cast(), name.len(), ty) } + unsafe { llvm::LLVMRustGetOrInsertGlobal(self.llmod, name.as_c_char_ptr(), name.len(), ty) } } /// Declare a C ABI function. @@ -209,7 +210,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { /// Gets declared value by name. pub(crate) fn get_declared_value(&self, name: &str) -> Option<&'ll Value> { debug!("get_declared_value(name={:?})", name); - unsafe { llvm::LLVMRustGetNamedValue(self.llmod, name.as_ptr().cast(), name.len()) } + unsafe { llvm::LLVMRustGetNamedValue(self.llmod, name.as_c_char_ptr(), name.len()) } } /// Gets defined or externally defined (AvailableExternally linkage) value by |
