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().
This commit is contained in:
Andrew Kelley 2021-05-17 13:44:20 -07:00
parent d839835273
commit 3697022a41

View File

@ -3499,9 +3499,11 @@ pub fn deleteDecl(
}
_ = mod.compile_log_decls.swapRemove(decl);
mod.deleteDeclExports(decl);
mod.comp.bin_file.freeDecl(decl);
if (decl.has_tv) {
if (decl.ty.hasCodeGenBits()) {
mod.comp.bin_file.freeDecl(decl);
}
if (decl.getInnerNamespace()) |namespace| {
try namespace.deleteAllDecls(mod, outdated_decls);
}