| author | |
| committer | |
| log | e39c86399da565d3855d54b242bf7b5940e3924d |
| tree | b67c392b14d2adc64e15c890ed978daf05fb9ceb |
| parent | b59428e9f78b1f9f265c0ffdba79b128d77644d2 |
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.2 files changed, 7 insertions(+), 1 deletions(-)
src/link/Dwarf.zig+1-1| ... | ... | @@ -91,7 +91,7 @@ pub const DeclState = struct { |
| 91 | 91 | }; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | fn deinit(self: *DeclState, gpa: Allocator) void { | |
| 94 | pub fn deinit(self: *DeclState, gpa: Allocator) void { | |
| 95 | 95 | self.dbg_line.deinit(); |
| 96 | 96 | self.dbg_info.deinit(); |
| 97 | 97 | self.abbrev_type_arena.deinit(); |
src/link/Elf.zig+6| ... | ... | @@ -2342,6 +2342,12 @@ pub fn updateFunc(self: *Elf, module: *Module, func: *Module.Fn, air: Air, liven |
| 2342 | 2342 | if (self.dwarf) |*dw| { |
| 2343 | 2343 | try dw.initDeclState(decl); |
| 2344 | 2344 | } |
| 2345 | defer if (self.dwarf) |*dw| { | |
| 2346 | if (dw.decl_state) |*ds| { | |
| 2347 | ds.deinit(dw.allocator); | |
| 2348 | dw.decl_state = null; | |
| 2349 | } | |
| 2350 | }; | |
| 2345 | 2351 | |
| 2346 | 2352 | const res = if (self.dwarf) |*dw| |
| 2347 | 2353 | try codegen.generateFunction(&self.base, decl.srcLoc(), func, air, liveness, &code_buffer, .{ |