diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-12-05 21:39:15 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-12-05 21:39:15 -0500 |
| commit | 0c531d447df88ed6c46e759fbfc9d253d2650c22 (patch) | |
| tree | f2c83b6c7c099e155f3b1ff58186f907e5494126 /src | |
| parent | bed83bc5a14aa6c0480dcfa842d97cce64427e1b (diff) | |
| download | zig-0c531d447df88ed6c46e759fbfc9d253d2650c22.tar.gz zig-0c531d447df88ed6c46e759fbfc9d253d2650c22.zip | |
remove the boolean argument from setFnTest
Diffstat (limited to 'src')
| -rw-r--r-- | src/all_types.hpp | 2 | ||||
| -rw-r--r-- | src/codegen.cpp | 2 | ||||
| -rw-r--r-- | src/ir.cpp | 30 | ||||
| -rw-r--r-- | src/ir_print.cpp | 2 |
4 files changed, 7 insertions, 29 deletions
diff --git a/src/all_types.hpp b/src/all_types.hpp index 1fd22d650b..cfc35dd6db 100644 --- a/src/all_types.hpp +++ b/src/all_types.hpp @@ -987,7 +987,6 @@ struct FnTableEntry { AstNode *fn_no_inline_set_node; AstNode *fn_export_set_node; - AstNode *fn_test_set_node; AstNode *fn_static_eval_set_node; ZigList<IrInstruction *> alloca_list; @@ -1674,7 +1673,6 @@ struct IrInstructionSetFnTest { IrInstruction base; IrInstruction *fn_value; - IrInstruction *is_test; }; struct IrInstructionSetFnVisible { diff --git a/src/codegen.cpp b/src/codegen.cpp index 8106b9f33a..00f81a3bf7 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -3083,7 +3083,7 @@ static void define_builtin_fns(CodeGen *g) { create_builtin_fn_with_arg_count(g, BuiltinFnIdCompileErr, "compileError", 1); create_builtin_fn_with_arg_count(g, BuiltinFnIdIntType, "intType", 2); create_builtin_fn_with_arg_count(g, BuiltinFnIdUnreachable, "unreachable", 0); - create_builtin_fn_with_arg_count(g, BuiltinFnIdSetFnTest, "setFnTest", 2); + create_builtin_fn_with_arg_count(g, BuiltinFnIdSetFnTest, "setFnTest", 1); create_builtin_fn_with_arg_count(g, BuiltinFnIdSetFnVisible, "setFnVisible", 2); create_builtin_fn_with_arg_count(g, BuiltinFnIdSetFnNoInline, "setFnNoInline", 2); create_builtin_fn_with_arg_count(g, BuiltinFnIdSetDebugSafety, "setDebugSafety", 2); diff --git a/src/ir.cpp b/src/ir.cpp index 9bde6c149a..5869d2d3e1 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -934,15 +934,13 @@ static IrInstruction *ir_build_ptr_type_child(IrBuilder *irb, Scope *scope, AstN return &instruction->base; } -static IrInstruction *ir_build_set_fn_test(IrBuilder *irb, Scope *scope, AstNode *source_node, IrInstruction *fn_value, - IrInstruction *is_test) +static IrInstruction *ir_build_set_fn_test(IrBuilder *irb, Scope *scope, AstNode *source_node, + IrInstruction *fn_value) { IrInstructionSetFnTest *instruction = ir_build_instruction<IrInstructionSetFnTest>(irb, scope, source_node); instruction->fn_value = fn_value; - instruction->is_test = is_test; ir_ref_instruction(fn_value); - ir_ref_instruction(is_test); return &instruction->base; } @@ -1786,12 +1784,7 @@ static IrInstruction *ir_gen_builtin_fn_call(IrBuilder *irb, Scope *scope, AstNo if (arg0_value == irb->codegen->invalid_instruction) return arg0_value; - AstNode *arg1_node = node->data.fn_call_expr.params.at(1); - IrInstruction *arg1_value = ir_gen_node(irb, arg1_node, scope); - if (arg1_value == irb->codegen->invalid_instruction) - return arg1_value; - - return ir_build_set_fn_test(irb, scope, node, arg0_value, arg1_value); + return ir_build_set_fn_test(irb, scope, node, arg0_value); } case BuiltinFnIdSetFnVisible: { @@ -5680,26 +5673,15 @@ static TypeTableEntry *ir_analyze_instruction_set_fn_test(IrAnalyze *ira, IrInstructionSetFnTest *set_fn_test_instruction) { IrInstruction *fn_value = set_fn_test_instruction->fn_value->other; - IrInstruction *is_test_value = set_fn_test_instruction->is_test->other; FnTableEntry *fn_entry = ir_resolve_fn(ira, fn_value); if (!fn_entry) return ira->codegen->builtin_types.entry_invalid; - if (!ir_resolve_bool(ira, is_test_value, &fn_entry->is_test)) - return ira->codegen->builtin_types.entry_invalid; - - AstNode *source_node = set_fn_test_instruction->base.source_node; - if (fn_entry->fn_test_set_node) { - ErrorMsg *msg = add_node_error(ira->codegen, source_node, - buf_sprintf("function test attribute set twice")); - add_error_note(ira->codegen, msg, fn_entry->fn_test_set_node, buf_sprintf("first set here")); - return ira->codegen->builtin_types.entry_invalid; - } - fn_entry->fn_test_set_node = source_node; - - if (fn_entry->is_test) + if (!fn_entry->is_test) { + fn_entry->is_test = true; ira->codegen->test_fn_count += 1; + } ir_build_const_from(ira, &set_fn_test_instruction->base, false); return ira->codegen->builtin_types.entry_void; diff --git a/src/ir_print.cpp b/src/ir_print.cpp index 7f27ab104b..16a0ae3c78 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -491,8 +491,6 @@ static void ir_print_enum_field_ptr(IrPrint *irp, IrInstructionEnumFieldPtr *ins static void ir_print_set_fn_test(IrPrint *irp, IrInstructionSetFnTest *instruction) { fprintf(irp->f, "@setFnTest("); ir_print_other_instruction(irp, instruction->fn_value); - fprintf(irp->f, ", "); - ir_print_other_instruction(irp, instruction->is_test); fprintf(irp->f, ")"); } |
