authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-02-19 15:34:44-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-02-19 15:34:44-05:00
logc8ce351ec982608d3ea0c60a34c7b18d894dee01
tree72872a0203c6cf61bf4a62dcb6950d393f73aa92
parent1034af40f96ef6c926f8a4e41bee19c59b311ed7
signaturelock-open Commit is signed but in an unrecognized format.

pull request fixups


1 files changed, 17 insertions(+), 10 deletions(-)

src/ir.cpp+17-10
...@@ -1303,15 +1303,23 @@ static IrInstruction *ir_build_ptr_type(IrBuilder *irb, Scope *scope, AstNode *s...@@ -1303,15 +1303,23 @@ static IrInstruction *ir_build_ptr_type(IrBuilder *irb, Scope *scope, AstNode *s
1303 return &ptr_type_of_instruction->base;1303 return &ptr_type_of_instruction->base;
1304}1304}
13051305
1306static IrInstruction *ir_build_un_op(IrBuilder *irb, Scope *scope, AstNode *source_node, IrUnOp op_id, IrInstruction *value) {1306static IrInstruction *ir_build_un_op_lval(IrBuilder *irb, Scope *scope, AstNode *source_node, IrUnOp op_id,
1307 IrInstructionUnOp *br_instruction = ir_build_instruction<IrInstructionUnOp>(irb, scope, source_node);1307 IrInstruction *value, LVal lval)
1308 br_instruction->op_id = op_id;1308{
1309 br_instruction->value = value;1309 IrInstructionUnOp *instruction = ir_build_instruction<IrInstructionUnOp>(irb, scope, source_node);
1310 br_instruction->lval = LValNone;1310 instruction->op_id = op_id;
1311 instruction->value = value;
1312 instruction->lval = lval;
13111313
1312 ir_ref_instruction(value, irb->current_basic_block);1314 ir_ref_instruction(value, irb->current_basic_block);
13131315
1314 return &br_instruction->base;1316 return &instruction->base;
1317}
1318
1319static IrInstruction *ir_build_un_op(IrBuilder *irb, Scope *scope, AstNode *source_node, IrUnOp op_id,
1320 IrInstruction *value)
1321{
1322 return ir_build_un_op_lval(irb, scope, source_node, op_id, value, LValNone);
1315}1323}
13161324
1317static IrInstruction *ir_build_container_init_list(IrBuilder *irb, Scope *scope, AstNode *source_node,1325static IrInstruction *ir_build_container_init_list(IrBuilder *irb, Scope *scope, AstNode *source_node,
...@@ -7227,10 +7235,7 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop...@@ -7227,10 +7235,7 @@ static IrInstruction *ir_gen_node_raw(IrBuilder *irb, AstNode *node, Scope *scop
7227 // We essentially just converted any lvalue from &(x.*) to (&x).*;7235 // We essentially just converted any lvalue from &(x.*) to (&x).*;
7228 // this inhibits checking that x is a pointer later, so we directly7236 // this inhibits checking that x is a pointer later, so we directly
7229 // record whether the pointer check is needed7237 // record whether the pointer check is needed
7230 IrInstructionUnOp *result = (IrInstructionUnOp*)ir_build_un_op(irb, scope, node, IrUnOpDereference, value);7238 return ir_build_un_op_lval(irb, scope, node, IrUnOpDereference, value, lval);
7231 result->lval = lval;
7232
7233 return &result->base;
7234 }7239 }
7235 case NodeTypeUnwrapOptional: {7240 case NodeTypeUnwrapOptional: {
7236 AstNode *expr_node = node->data.unwrap_optional.expr;7241 AstNode *expr_node = node->data.unwrap_optional.expr;
...@@ -13685,6 +13690,8 @@ no_mem_slot:...@@ -13685,6 +13690,8 @@ no_mem_slot:
13685static IrInstruction *ir_analyze_store_ptr(IrAnalyze *ira, IrInstruction *source_instr,13690static IrInstruction *ir_analyze_store_ptr(IrAnalyze *ira, IrInstruction *source_instr,
13686 IrInstruction *ptr, IrInstruction *uncasted_value)13691 IrInstruction *ptr, IrInstruction *uncasted_value)
13687{13692{
13693 assert(ptr->value.type->id == ZigTypeIdPointer);
13694
13688 if (ptr->value.data.x_ptr.special == ConstPtrSpecialDiscard) {13695 if (ptr->value.data.x_ptr.special == ConstPtrSpecialDiscard) {
13689 return ir_const_void(ira, source_instr);13696 return ir_const_void(ira, source_instr);
13690 }13697 }