aboutsummaryrefslogtreecommitdiff
path: root/src/Package.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-09-29 00:13:21 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-09-29 00:13:21 -0700
commit99961f22dca7e01b85b7819dcea814ad01b65af5 (patch)
tree9c788bb803cf52cbb9928137b811b915097b46a7 /src/Package.zig
parent33e77f127d8237088b561fae2ca0f4412bc1d6c9 (diff)
downloadzig-99961f22dca7e01b85b7819dcea814ad01b65af5.tar.gz
zig-99961f22dca7e01b85b7819dcea814ad01b65af5.zip
stage2: enable building compiler_rt when using LLVM backend
* AstGen: fix emitting `store_to_inferred_ptr` when it should be emitting `store` for a variable that has an explicit alignment. * Compilation: fix a couple memory leaks * Sema: implement support for locals that have specified alignment. * Sema: implement `@intCast` when it needs to emit an AIR instruction. * Sema: implement `@alignOf` * Implement debug printing for extended alloc ZIR instructions.
Diffstat (limited to 'src/Package.zig')
-rw-r--r--src/Package.zig15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Package.zig b/src/Package.zig
index 3814f0eb95..f5380aaacb 100644
--- a/src/Package.zig
+++ b/src/Package.zig
@@ -99,15 +99,18 @@ pub fn destroy(pkg: *Package, gpa: *Allocator) void {
}
}
- {
- var it = pkg.table.keyIterator();
- while (it.next()) |key| {
- gpa.free(key.*);
- }
+ pkg.deinitTable(gpa);
+ gpa.destroy(pkg);
+}
+
+/// Only frees memory associated with the table.
+pub fn deinitTable(pkg: *Package, gpa: *Allocator) void {
+ var it = pkg.table.keyIterator();
+ while (it.next()) |key| {
+ gpa.free(key.*);
}
pkg.table.deinit(gpa);
- gpa.destroy(pkg);
}
pub fn add(pkg: *Package, gpa: *Allocator, name: []const u8, package: *Package) !void {