New @export() handling

Use a struct as second parameter to be future proof (and also allows to
specify default values for the parameters)

Closes #2679 as it was just a matter of a few lines of code.
This commit is contained in:
LemonBoy
2020-01-09 10:36:51 +01:00
committed by Andrew Kelley
parent 4613e4d15f
commit 5ab5de89c0
13 changed files with 314 additions and 277 deletions

View File

@@ -1893,21 +1893,11 @@ static void ir_print_enum_tag_type(IrPrint *irp, IrInstructionTagType *instructi
}
static void ir_print_export(IrPrint *irp, IrInstructionExport *instruction) {
if (instruction->linkage == nullptr) {
fprintf(irp->f, "@export(");
ir_print_other_instruction(irp, instruction->name);
fprintf(irp->f, ",");
ir_print_other_instruction(irp, instruction->target);
fprintf(irp->f, ")");
} else {
fprintf(irp->f, "@exportWithLinkage(");
ir_print_other_instruction(irp, instruction->name);
fprintf(irp->f, ",");
ir_print_other_instruction(irp, instruction->target);
fprintf(irp->f, ",");
ir_print_other_instruction(irp, instruction->linkage);
fprintf(irp->f, ")");
}
fprintf(irp->f, "@export(");
ir_print_other_instruction(irp, instruction->target);
fprintf(irp->f, ",");
ir_print_other_instruction(irp, instruction->options);
fprintf(irp->f, ")");
}
static void ir_print_error_return_trace(IrPrint *irp, IrInstructionErrorReturnTrace *instruction) {