Eliminate all direct uses of LLVMMDStringInContext2

This commit is contained in:
Oli Scherer
2025-07-09 09:48:46 +00:00
parent 56d22cd29f
commit 7f95f04267
9 changed files with 26 additions and 28 deletions

View File

@@ -139,7 +139,8 @@ pub(crate) fn load_vtable<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
&& bx.cx().sess().lto() == Lto::Fat
{
if let Some(trait_ref) = dyn_trait_in_self(bx.tcx(), ty) {
let typeid = bx.typeid_metadata(typeid_for_trait_ref(bx.tcx(), trait_ref)).unwrap();
let typeid =
bx.typeid_metadata(typeid_for_trait_ref(bx.tcx(), trait_ref).as_bytes()).unwrap();
let func = bx.type_checked_load(llvtable, vtable_byte_offset, typeid);
return func;
} else if nonnull {

View File

@@ -154,9 +154,9 @@ pub trait LayoutTypeCodegenMethods<'tcx>: BackendTypes {
// For backends that support CFI using type membership (i.e., testing whether a given pointer is
// associated with a type identifier).
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::Metadata> {
fn add_type_metadata(&self, _function: Self::Function, _typeid: &[u8]) {}
fn set_type_metadata(&self, _function: Self::Function, _typeid: &[u8]) {}
fn typeid_metadata(&self, _typeid: &[u8]) -> Option<Self::Metadata> {
None
}
fn add_kcfi_type_metadata(&self, _function: Self::Function, _typeid: u32) {}