Use a safe wrapper around an LLVM FFI function
This commit is contained in:
parent
f16f64b15a
commit
3565603d25
5 changed files with 13 additions and 8 deletions
|
@ -649,7 +649,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
|
|||
fn type_test(&mut self, pointer: Self::Value, typeid: Self::Metadata) -> Self::Value {
|
||||
// Test the called operand using llvm.type.test intrinsic. The LowerTypeTests link-time
|
||||
// optimization pass replaces calls to this intrinsic with code to test type membership.
|
||||
let typeid = unsafe { llvm::LLVMMetadataAsValue(&self.llcx, typeid) };
|
||||
let typeid = self.get_metadata_value(typeid);
|
||||
self.call_intrinsic("llvm.type.test", &[pointer, typeid])
|
||||
}
|
||||
|
||||
|
@ -659,7 +659,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
|
|||
vtable_byte_offset: u64,
|
||||
typeid: &'ll Metadata,
|
||||
) -> Self::Value {
|
||||
let typeid = unsafe { llvm::LLVMMetadataAsValue(&self.llcx, typeid) };
|
||||
let typeid = self.get_metadata_value(typeid);
|
||||
let vtable_byte_offset = self.const_i32(vtable_byte_offset as i32);
|
||||
let type_checked_load =
|
||||
self.call_intrinsic("llvm.type.checked.load", &[llvtable, vtable_byte_offset, typeid]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue