mirror of
https://github.com/ziglang/zig.git
synced 2026-01-10 17:35:12 +00:00
link: half-hearted bug fix for decl_state field
The init()/commit() API of this field leads to the type of bug that this commit fixes by defering an uncomfortably complex expression. I didn't bother doing the equivalent fix in link/MachO.zig because instead I think the `decl_state` field should be entirely removed from Dwarf.
This commit is contained in:
parent
b59428e9f7
commit
e39c86399d
@ -91,7 +91,7 @@ pub const DeclState = struct {
|
||||
};
|
||||
}
|
||||
|
||||
fn deinit(self: *DeclState, gpa: Allocator) void {
|
||||
pub fn deinit(self: *DeclState, gpa: Allocator) void {
|
||||
self.dbg_line.deinit();
|
||||
self.dbg_info.deinit();
|
||||
self.abbrev_type_arena.deinit();
|
||||
|
||||
@ -2342,6 +2342,12 @@ pub fn updateFunc(self: *Elf, module: *Module, func: *Module.Fn, air: Air, liven
|
||||
if (self.dwarf) |*dw| {
|
||||
try dw.initDeclState(decl);
|
||||
}
|
||||
defer if (self.dwarf) |*dw| {
|
||||
if (dw.decl_state) |*ds| {
|
||||
ds.deinit(dw.allocator);
|
||||
dw.decl_state = null;
|
||||
}
|
||||
};
|
||||
|
||||
const res = if (self.dwarf) |*dw|
|
||||
try codegen.generateFunction(&self.base, decl.srcLoc(), func, air, liveness, &code_buffer, .{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user