aboutsummaryrefslogtreecommitdiff
path: root/src/InternPool.zig
diff options
context:
space:
mode:
authorkcbanner <kcbanner@gmail.com>2023-10-24 01:44:44 -0400
committerMatthew Lugg <mlugg@mlugg.co.uk>2023-10-31 01:35:58 +0000
commitfb523c6283be546369250b9172aad040d44f42dd (patch)
treecc0c2a6462ca1bcf91f5994f45e2e301e51318d1 /src/InternPool.zig
parent4d044ee7e0b1ca61b8f2205f318449780ae23bd2 (diff)
downloadzig-fb523c6283be546369250b9172aad040d44f42dd.tar.gz
zig-fb523c6283be546369250b9172aad040d44f42dd.zip
sema: when guessing union alignment, save the result and check if the guess was correct
Diffstat (limited to 'src/InternPool.zig')
-rw-r--r--src/InternPool.zig11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/InternPool.zig b/src/InternPool.zig
index a4fefaba29..700c5859b8 100644
--- a/src/InternPool.zig
+++ b/src/InternPool.zig
@@ -690,13 +690,13 @@ pub const Key = union(enum) {
/// The returned pointer expires with any addition to the `InternPool`.
pub fn size(self: @This(), ip: *InternPool) *u32 {
const size_field_index = std.meta.fieldIndex(Tag.TypeUnion, "size").?;
- return @ptrCast(&ip.extra.items[self.extra_index + size_field_index]);
+ return &ip.extra.items[self.extra_index + size_field_index];
}
/// The returned pointer expires with any addition to the `InternPool`.
pub fn padding(self: @This(), ip: *InternPool) *u32 {
const padding_field_index = std.meta.fieldIndex(Tag.TypeUnion, "padding").?;
- return @ptrCast(&ip.extra.items[self.extra_index + padding_field_index]);
+ return &ip.extra.items[self.extra_index + padding_field_index];
}
pub fn haveFieldTypes(self: @This(), ip: *const InternPool) bool {
@@ -2965,9 +2965,9 @@ pub const Tag = enum(u8) {
/// 1. field align: Alignment for each field; declaration order
pub const TypeUnion = struct {
flags: Flags,
- // Only valid after .have_layout
+ /// Only valid after .have_layout
size: u32,
- // Only valid after .have_layout
+ /// Only valid after .have_layout
padding: u32,
decl: Module.Decl.Index,
namespace: Module.Namespace.Index,
@@ -2983,8 +2983,9 @@ pub const Tag = enum(u8) {
status: UnionType.Status,
requires_comptime: RequiresComptime,
assumed_runtime_bits: bool,
+ assumed_pointer_aligned: bool,
alignment: Alignment,
- _: u15 = 0,
+ _: u14 = 0,
};
};