aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2024-02-22 19:24:16 +0000
committergingerBill <bill@gingerbill.org>2024-02-22 19:24:16 +0000
commit3060225f460cb5d1ad124fcf449b27b3e2e981f8 (patch)
tree028625f50d0c51f4cacf4d6a7bc7fd753666410a /src/llvm_backend_expr.cpp
parentc14b9d461a5c58d4b80957682f00205714063435 (diff)
Simplify usage code
Diffstat (limited to 'src/llvm_backend_expr.cpp')
-rw-r--r--src/llvm_backend_expr.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/llvm_backend_expr.cpp b/src/llvm_backend_expr.cpp
index 5bf2642e6..442121f83 100644
--- a/src/llvm_backend_expr.cpp
+++ b/src/llvm_backend_expr.cpp
@@ -4684,15 +4684,17 @@ gb_internal lbAddr lb_build_addr_internal(lbProcedure *p, Ast *expr) {
Selection sub_sel = sel;
sub_sel.index.count -= 1;
- Type *bf_type = type_from_selection(type, sub_sel);
- bf_type = base_type(type_deref(bf_type));
- GB_ASSERT(bf_type->kind == Type_BitField);
lbValue a = lb_addr_get_ptr(p, addr);
if (sub_sel.index.count > 0) {
a = lb_emit_deep_field_gep(p, a, sub_sel);
}
+
+ Type *bf_type = type_deref(a.type);
+ bf_type = base_type(type_deref(bf_type));
+ GB_ASSERT(bf_type->kind == Type_BitField);
+
i32 index = sel.index[sel.index.count-1];
Entity *f = bf_type->BitField.fields[index];