authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-17 13:44:20-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-17 13:44:20-07:00
log3697022a41ffa13a3971aeaf96b9c2b8de391ab1
tree94e7a23c262fcb7b0427437502c72a845769b980
parentd83983527323201c44f90a2f57ff58c746116e11

stage2: avoid calling freeDecl when hasCodeGenBits == false

Previously the frontend incorrectly called freeDecl for structs, which never got allocateDecl called for them. There was simply a missing check for hasCodeGenBits().

1 files changed, 3 insertions(+), 1 deletions(-)

src/Module.zig+3-1
......@@ -3499,9 +3499,11 @@ pub fn deleteDecl(
34993499 }
35003500 _ = mod.compile_log_decls.swapRemove(decl);
35013501 mod.deleteDeclExports(decl);
3502 mod.comp.bin_file.freeDecl(decl);
35033502
35043503 if (decl.has_tv) {
3504 if (decl.ty.hasCodeGenBits()) {
3505 mod.comp.bin_file.freeDecl(decl);
3506 }
35053507 if (decl.getInnerNamespace()) |namespace| {
35063508 try namespace.deleteAllDecls(mod, outdated_decls);
35073509 }