diff options
| author | gingerBill <bill@gingerbill.org> | 2020-01-12 13:53:51 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-01-12 13:53:51 +0000 |
| commit | 7d9a9a2283c6c0cbd1e1034b2496d4898335beb0 (patch) | |
| tree | 7d57d562aa74bb52ff1d9e6f3ed1d4583f41a0a9 /src/ir.cpp | |
| parent | cfba29002a60a96633e94ebd0cd5899e960d2dc0 (diff) | |
Add extra check for opaque types
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 2de2b2669..8af0b85bd 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -4713,6 +4713,10 @@ irValue *ir_emit_struct_ep(irProcedure *proc, irValue *s, i32 index) { Type *t = base_type(type_deref(ir_type(s))); Type *result_type = nullptr; + if (t->kind == Type_Opaque) { + t = t->Opaque.elem; + } + if (is_type_struct(t)) { result_type = alloc_type_pointer(t->Struct.fields[index]->type); } else if (is_type_union(t)) { @@ -4896,6 +4900,9 @@ irValue *ir_emit_deep_field_gep(irProcedure *proc, irValue *e, Selection sel) { // e = ir_emit_ptr_offset(proc, e, v_zero); // TODO(bill): Do I need these copies? } type = core_type(type); + if (type->kind == Type_Opaque) { + type = type->Opaque.elem; + } if (is_type_quaternion(type)) { e = ir_emit_struct_ep(proc, e, index); |