diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2017-01-24 01:58:20 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2017-01-24 02:02:48 -0500 |
| commit | 4b3f18de3c5746b2ecfd6183351913de0909a83b (patch) | |
| tree | e3d0d56fcd8c00d994a13c4d69d60f0ab28fe389 /src/ir_print.cpp | |
| parent | 32d8686da80d282e8cd6d84a0e5c331d269a1f69 (diff) | |
| download | zig-4b3f18de3c5746b2ecfd6183351913de0909a83b.tar.gz zig-4b3f18de3c5746b2ecfd6183351913de0909a83b.zip | |
printf var args proof of concept
See #167
Need to troubleshoot when we send 2 slices to printf. It goes
into an infinite loop.
This commit introduces 4 builtin functions:
* `@isInteger`
* `@isFloat`
* `@canImplictCast`
* `@typeName`
Diffstat (limited to 'src/ir_print.cpp')
| -rw-r--r-- | src/ir_print.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp index 418b4b5e7c..79e0bdb895 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -807,6 +807,26 @@ static void ir_print_check_switch_prongs(IrPrint *irp, IrInstructionCheckSwitchP fprintf(irp->f, ")"); } +static void ir_print_test_type(IrPrint *irp, IrInstructionTestType *instruction) { + fprintf(irp->f, "@testType("); + ir_print_other_instruction(irp, instruction->type_value); + fprintf(irp->f, ")"); +} + +static void ir_print_type_name(IrPrint *irp, IrInstructionTypeName *instruction) { + fprintf(irp->f, "@typeName("); + ir_print_other_instruction(irp, instruction->type_value); + fprintf(irp->f, ")"); +} + +static void ir_print_can_implicit_cast(IrPrint *irp, IrInstructionCanImplicitCast *instruction) { + fprintf(irp->f, "@canImplicitCast("); + ir_print_other_instruction(irp, instruction->type_value); + fprintf(irp->f, ","); + ir_print_other_instruction(irp, instruction->target_value); + fprintf(irp->f, ")"); +} + static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { ir_print_prefix(irp, instruction); switch (instruction->id) { @@ -1064,6 +1084,15 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { case IrInstructionIdCheckSwitchProngs: ir_print_check_switch_prongs(irp, (IrInstructionCheckSwitchProngs *)instruction); break; + case IrInstructionIdTestType: + ir_print_test_type(irp, (IrInstructionTestType *)instruction); + break; + case IrInstructionIdTypeName: + ir_print_type_name(irp, (IrInstructionTypeName *)instruction); + break; + case IrInstructionIdCanImplicitCast: + ir_print_can_implicit_cast(irp, (IrInstructionCanImplicitCast *)instruction); + break; } fprintf(irp->f, "\n"); } |
