aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-10-21 21:38:55 -0400
committerGitHub <noreply@github.com>2023-10-21 21:38:55 -0400
commit7d50634e0ad4355e339bc243a2e2842693e133f9 (patch)
treecd6f81b82b20532d40e0944e6a814519ebf7cb41 /src/codegen.zig
parent3cd3052d4d303dbae7d517fa40f6d171c957afdd (diff)
parent3d7c6c803b788138aa08f51cf4ee8cf7892e315d (diff)
downloadzig-7d50634e0ad4355e339bc243a2e2842693e133f9.tar.gz
zig-7d50634e0ad4355e339bc243a2e2842693e133f9.zip
Merge pull request #17545 from ziglang/more-anon-decls
migrate make_ptr_const to new anonymous decl mechanism
Diffstat (limited to 'src/codegen.zig')
-rw-r--r--src/codegen.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/codegen.zig b/src/codegen.zig
index 24269f38ba..fe948d18bd 100644
--- a/src/codegen.zig
+++ b/src/codegen.zig
@@ -713,7 +713,7 @@ const RelocInfo = struct {
fn lowerAnonDeclRef(
bin_file: *link.File,
src_loc: Module.SrcLoc,
- decl_val: InternPool.Index,
+ anon_decl: InternPool.Key.Ptr.Addr.AnonDecl,
code: *std.ArrayList(u8),
debug_output: DebugInfoOutput,
reloc_info: RelocInfo,
@@ -723,6 +723,7 @@ fn lowerAnonDeclRef(
const mod = bin_file.options.module.?;
const ptr_width_bytes = @divExact(target.ptrBitWidth(), 8);
+ const decl_val = anon_decl.val;
const decl_ty = mod.intern_pool.typeOf(decl_val).toType();
const is_fn_body = decl_ty.zigTypeTag(mod) == .Fn;
if (!is_fn_body and !decl_ty.hasRuntimeBits(mod)) {
@@ -730,7 +731,8 @@ fn lowerAnonDeclRef(
return Result.ok;
}
- const res = try bin_file.lowerAnonDecl(decl_val, src_loc);
+ const decl_align = mod.intern_pool.indexToKey(anon_decl.orig_ty).ptr_type.flags.alignment;
+ const res = try bin_file.lowerAnonDecl(decl_val, decl_align, src_loc);
switch (res) {
.ok => {},
.fail => |em| return .{ .fail = em },