| author | |
| committer | |
| log | 089c056dbe1fdbb1da9b1a5bab970ca688d3aa01 |
| tree | 2f3b88181b0da90e4ceae6739d265112dfff0c7d |
| parent | 7a6104929b2d140235597d866dc0fabc93df036f |
| signature |
2 files changed, 18 insertions(+), 3 deletions(-)
src-self-hosted/Module.zig+2-3| ... | ... | @@ -744,7 +744,7 @@ pub fn init(gpa: *Allocator, options: InitOptions) !Module { |
| 744 | 744 | .object_format = options.object_format orelse options.target.getObjectFormat(), |
| 745 | 745 | .cbe = options.cbe, |
| 746 | 746 | }); |
| 747 | errdefer bin_file.*.deinit(); | |
| 747 | errdefer bin_file.destroy(); | |
| 748 | 748 | |
| 749 | 749 | const root_scope = blk: { |
| 750 | 750 | if (mem.endsWith(u8, options.root_pkg.root_src_path, ".zig")) { |
| ... | ... | @@ -793,9 +793,8 @@ pub fn init(gpa: *Allocator, options: InitOptions) !Module { |
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | pub fn deinit(self: *Module) void { |
| 796 | self.bin_file.deinit(); | |
| 796 | self.bin_file.destroy(); | |
| 797 | 797 | const allocator = self.allocator; |
| 798 | allocator.destroy(self.bin_file); | |
| 799 | 798 | self.deletion_set.deinit(allocator); |
| 800 | 799 | self.work_queue.deinit(); |
| 801 | 800 |
src-self-hosted/link.zig+16| ... | ... | @@ -159,6 +159,22 @@ pub const File = struct { |
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | pub fn destroy(base: *File) void { | |
| 163 | switch (base.tag) { | |
| 164 | .Elf => { | |
| 165 | const parent = @fieldParentPtr(Elf, "base", base); | |
| 166 | parent.deinit(); | |
| 167 | parent.allocator.destroy(parent); | |
| 168 | }, | |
| 169 | .C => { | |
| 170 | const parent = @fieldParentPtr(C, "base", base); | |
| 171 | parent.deinit(); | |
| 172 | parent.allocator.destroy(parent); | |
| 173 | }, | |
| 174 | else => unreachable, | |
| 175 | } | |
| 176 | } | |
| 177 | ||
| 162 | 178 | pub fn flush(base: *File) !void { |
| 163 | 179 | try switch (base.tag) { |
| 164 | 180 | .Elf => @fieldParentPtr(Elf, "base", base).flush(), |