mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-06 02:34:05 +00:00
Add metadata to packed structs field accesses to state it is packed
This commit is contained in:
@@ -1107,6 +1107,12 @@ gb_internal lbValue lb_emit_load(lbProcedure *p, lbValue value) {
|
||||
GB_ASSERT(is_type_pointer(value.type));
|
||||
Type *t = type_deref(value.type);
|
||||
LLVMValueRef v = LLVMBuildLoad2(p->builder, lb_type(p->module, t), value.value, "");
|
||||
|
||||
u64 is_packed = lb_get_metadata_custom_u64(p->module, v, ODIN_METADATA_IS_PACKED);
|
||||
if (is_packed != 0) {
|
||||
LLVMSetAlignment(v, 1);
|
||||
}
|
||||
|
||||
return lbValue{v, t};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user