aboutsummaryrefslogtreecommitdiff
path: root/src/ir_print.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2017-10-18 22:26:04 +0100
committergingerBill <bill@gingerbill.org>2017-10-18 22:26:04 +0100
commit6c8c430c2a5af0a04a70cb4e9bf79c22f6554ab9 (patch)
treedaee58177d464d0340d2d0666a39957e480988cf /src/ir_print.cpp
parent57b97ad0bd9fe74115611bb8a365cb00552d702b (diff)
Fix enum iteration (issue #126)
Diffstat (limited to 'src/ir_print.cpp')
-rw-r--r--src/ir_print.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp
index 13dc87a57..f60764b94 100644
--- a/src/ir_print.cpp
+++ b/src/ir_print.cpp
@@ -423,6 +423,7 @@ void ir_print_compound_element(irFileBuffer *f, irModule *m, ExactValue v, Type
}
void ir_print_exact_value(irFileBuffer *f, irModule *m, ExactValue value, Type *type) {
+ Type *original_type = type;
type = core_type(type);
value = convert_exact_value_for_type(value, type);
@@ -612,6 +613,7 @@ void ir_print_exact_value(irFileBuffer *f, irModule *m, ExactValue value, Type *
ir_write_string(f, "]}");
} else if (is_type_struct(type)) {
gbTempArenaMemory tmp = gb_temp_arena_memory_begin(&m->tmp_arena);
+ defer (gb_temp_arena_memory_end(tmp));
ast_node(cl, CompoundLit, value.value_compound);
@@ -621,6 +623,7 @@ void ir_print_exact_value(irFileBuffer *f, irModule *m, ExactValue value, Type *
break;
}
+ String tstr = make_string_c(type_to_string(original_type));
isize value_count = type->Struct.fields.count;
ExactValue *values = gb_alloc_array(m->tmp_allocator, ExactValue, value_count);
@@ -650,7 +653,7 @@ void ir_print_exact_value(irFileBuffer *f, irModule *m, ExactValue value, Type *
if (tav.mode != Addressing_Invalid) {
val = tav.value;
}
- values[f->Variable.field_index] = val;
+ values[f->Variable.field_index] = val;
visited[f->Variable.field_index] = true;
}
}
@@ -693,8 +696,6 @@ void ir_print_exact_value(irFileBuffer *f, irModule *m, ExactValue value, Type *
ir_write_byte(f, '}');
if (type->Struct.is_packed) ir_write_byte(f, '>');
-
- gb_temp_arena_memory_end(tmp);
} else {
ir_write_string(f, "zeroinitializer");
}