aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-10-22 15:53:59 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-10-22 15:53:59 -0700
commitf0dcdd7931f1eb4f3b6a0a87c914baf770f6df03 (patch)
tree2182e84263410cd093d51c5df6393848f3724b22 /src/Module.zig
parent069c83d58cebba88275ee76ba01fabcd8e964573 (diff)
downloadzig-f0dcdd7931f1eb4f3b6a0a87c914baf770f6df03.tar.gz
zig-f0dcdd7931f1eb4f3b6a0a87c914baf770f6df03.zip
stage2: fix Decl addrspace being undefined
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 8677be224f..3ac523bdc5 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -4220,7 +4220,13 @@ fn markOutdatedDecl(mod: *Module, decl: *Decl) !void {
decl.analysis = .outdated;
}
-pub fn allocateNewDecl(mod: *Module, name: [:0]const u8, namespace: *Namespace, src_node: Ast.Node.Index, src_scope: ?*CaptureScope) !*Decl {
+pub fn allocateNewDecl(
+ mod: *Module,
+ name: [:0]const u8,
+ namespace: *Namespace,
+ src_node: Ast.Node.Index,
+ src_scope: ?*CaptureScope,
+) !*Decl {
// If we have emit-h then we must allocate a bigger structure to store the emit-h state.
const new_decl: *Decl = if (mod.emit_h != null) blk: {
const parent_struct = try mod.gpa.create(DeclPlusEmitH);
@@ -4242,7 +4248,7 @@ pub fn allocateNewDecl(mod: *Module, name: [:0]const u8, namespace: *Namespace,
.val = undefined,
.align_val = undefined,
.linksection_val = undefined,
- .@"addrspace" = undefined,
+ .@"addrspace" = .generic,
.analysis = .unreferenced,
.deletion_flag = false,
.zir_decl_index = 0,
@@ -4346,7 +4352,6 @@ pub fn createAnonymousDeclFromDeclNamed(
new_decl.val = typed_value.val;
new_decl.align_val = Value.initTag(.null_value);
new_decl.linksection_val = Value.initTag(.null_value);
- new_decl.@"addrspace" = .generic; // default global addrspace
new_decl.has_tv = true;
new_decl.analysis = .complete;
new_decl.generation = mod.generation;