Compilation: don't store arena until it's done being used

This commit is contained in:
Andrew Kelley
2023-12-16 15:49:08 -07:00
parent f256431838
commit 9b98d33d0b

View File

@@ -1443,7 +1443,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
comp.* = .{
.gpa = gpa,
.arena = arena_allocator,
.arena = undefined, // populated after we are finished with `arena`
.module = opt_zcu,
.cache_use = undefined, // populated below
.bin_file = null, // populated below
@@ -1667,6 +1667,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
},
}
comp.arena = arena_allocator;
break :comp comp;
};
errdefer comp.destroy();