WIP10 - Add debug assertions to printf

This commit is contained in:
David Mak 2024-08-12 16:41:30 +08:00
parent cf9bfec02d
commit 18ec4c1eac
1 changed files with 3 additions and 0 deletions

View File

@ -748,6 +748,9 @@ fn polymorphic_print<'ctx>(
generator: &mut dyn CodeGenerator,
fmt: String,
args: Vec<BasicValueEnum<'ctx>>| {
debug_assert!(!fmt.is_empty());
debug_assert_eq!(fmt.as_bytes().last().unwrap(), &0u8);
let fn_name = if as_rtio { "rtio_log" } else { "core_log" };
let print_fn = ctx.module.get_function(fn_name).unwrap_or_else(|| {
let llvm_pi8 = ctx.ctx.i8_type().ptr_type(AddressSpace::default());