From 8fd0fddce5d44344dd7914ae86a4d976b99f9cc3 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 2 Apr 2017 18:19:59 -0400 Subject: zig build system progress * In-progress os.ChildProcess.spawn implementation. See #204 * Add explicit cast from integer to error. Closes #294 * fix casting from error to integer * fix compiler crash when initializing variable to undefined with no type --- src/ir_print.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/ir_print.cpp') diff --git a/src/ir_print.cpp b/src/ir_print.cpp index 7814064f85..fd912d6919 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -799,6 +799,16 @@ static void ir_print_int_to_enum(IrPrint *irp, IrInstructionIntToEnum *instructi fprintf(irp->f, ")"); } +static void ir_print_int_to_err(IrPrint *irp, IrInstructionIntToErr *instruction) { + fprintf(irp->f, "inttoerr "); + ir_print_other_instruction(irp, instruction->target); +} + +static void ir_print_err_to_int(IrPrint *irp, IrInstructionErrToInt *instruction) { + fprintf(irp->f, "errtoint "); + ir_print_other_instruction(irp, instruction->target); +} + static void ir_print_check_switch_prongs(IrPrint *irp, IrInstructionCheckSwitchProngs *instruction) { fprintf(irp->f, "@checkSwitchProngs("); ir_print_other_instruction(irp, instruction->target_value); @@ -1117,6 +1127,12 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { case IrInstructionIdIntToEnum: ir_print_int_to_enum(irp, (IrInstructionIntToEnum *)instruction); break; + case IrInstructionIdIntToErr: + ir_print_int_to_err(irp, (IrInstructionIntToErr *)instruction); + break; + case IrInstructionIdErrToInt: + ir_print_err_to_int(irp, (IrInstructionErrToInt *)instruction); + break; case IrInstructionIdCheckSwitchProngs: ir_print_check_switch_prongs(irp, (IrInstructionCheckSwitchProngs *)instruction); break; -- cgit v1.2.3