Cast to expect_failed in LLVM, not zig

This commit is contained in:
Richard Feldman 2021-08-28 21:18:16 -04:00
parent 4e57b1edf2
commit b3e6a248cf

View file

@ -1,3 +1,4 @@
use std::convert::TryFrom;
use std::path::Path;
use crate::llvm::bitcode::{call_bitcode_fn, call_void_bitcode_fn};
@ -5181,14 +5182,18 @@ fn run_low_level<'a, 'ctx, 'env>(
bd.position_at_end(throw_block);
call_void_bitcode_fn(
env,
&[env
.ptr_int()
.const_int(expect_failed as *const () as u64, false)
.into()],
bitcode::EXPECT_FAILED,
);
let fn_ptr_type = context
.void_type()
.fn_type(&[], false)
.ptr_type(AddressSpace::Generic);
let fn_addr = env
.ptr_int()
.const_int(expect_failed as *const () as u64, false);
let func: PointerValue<'ctx> =
bd.build_int_to_ptr(fn_addr, fn_ptr_type, "cast_expect_failed_addr_to_ptr");
let callable = CallableValue::try_from(func).unwrap();
bd.build_call(callable, &[], "call_expect_failed");
bd.build_unconditional_branch(then_block);
bd.position_at_end(then_block);