1
Fork 0

Auto merge of #130389 - Luv-Ray:LLVMMDNodeInContext2, r=nikic

llvm: replace some deprecated functions

`LLVMMDStringInContext` and `LLVMMDNodeInContext` are deprecated, replace them with `LLVMMDStringInContext2` and `LLVMMDNodeInContext2`.
Also replace `Value` with `Metadata` in some function signatures for better consistency.
This commit is contained in:
bors 2024-09-24 12:07:48 +00:00
commit 4cbfcf1b7f
14 changed files with 66 additions and 91 deletions

View file

@ -21,6 +21,7 @@ use crate::{CodegenResults, ModuleCodegen};
pub trait BackendTypes {
type Value: CodegenObject;
type Metadata: CodegenObject;
type Function: CodegenObject;
type BasicBlock: Copy;

View file

@ -51,6 +51,7 @@ pub trait BuilderMethods<'a, 'tcx>:
type CodegenCx: CodegenMethods<
'tcx,
Value = Self::Value,
Metadata = Self::Metadata,
Function = Self::Function,
BasicBlock = Self::BasicBlock,
Type = Self::Type,

View file

@ -24,14 +24,14 @@ pub trait IntrinsicCallBuilderMethods<'tcx>: BackendTypes {
fn assume(&mut self, val: Self::Value);
fn expect(&mut self, cond: Self::Value, expected: bool) -> Self::Value;
/// Trait method used to test whether a given pointer is associated with a type identifier.
fn type_test(&mut self, pointer: Self::Value, typeid: Self::Value) -> Self::Value;
fn type_test(&mut self, pointer: Self::Value, typeid: Self::Metadata) -> Self::Value;
/// Trait method used to load a function while testing if it is associated with a type
/// identifier.
fn type_checked_load(
&mut self,
llvtable: Self::Value,
vtable_byte_offset: u64,
typeid: Self::Value,
typeid: Self::Metadata,
) -> Self::Value;
/// Trait method used to inject `va_start` on the "spoofed" `VaListImpl` in
/// Rust defined C-variadic functions.

View file

@ -152,7 +152,7 @@ pub trait LayoutTypeCodegenMethods<'tcx>: BackendTypes {
pub trait TypeMembershipCodegenMethods<'tcx>: BackendTypes {
fn add_type_metadata(&self, _function: Self::Function, _typeid: String) {}
fn set_type_metadata(&self, _function: Self::Function, _typeid: String) {}
fn typeid_metadata(&self, _typeid: String) -> Option<Self::Value> {
fn typeid_metadata(&self, _typeid: String) -> Option<Self::Metadata> {
None
}
fn add_kcfi_type_metadata(&self, _function: Self::Function, _typeid: u32) {}