aboutsummaryrefslogtreecommitdiff
path: root/src/main.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-03-20 22:40:08 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-03-20 22:40:08 -0700
commit7598a00f34e91375bc8d4f57e8f5ecbc0d1b4d14 (patch)
tree75338d2cf30fb9092692d0b447d8e2cd610d3023 /src/main.zig
parentd8692b8bdb4630f2bb2763cdbe609de7d73b28d8 (diff)
downloadzig-7598a00f34e91375bc8d4f57e8f5ecbc0d1b4d14.tar.gz
zig-7598a00f34e91375bc8d4f57e8f5ecbc0d1b4d14.zip
stage2: fix memory management of ZIR code
* free Module.Fn ZIR code when destroying the owner Decl * unreachable_safe and unreachable_unsafe are collapsed into one ZIR instruction with a safety flag. * astgen: emit an unreachable instruction for unreachable literals * don't forget to call deinit on ZIR code * astgen: implement some builtin functions
Diffstat (limited to 'src/main.zig')
-rw-r--r--src/main.zig33
1 files changed, 13 insertions, 20 deletions
diff --git a/src/main.zig b/src/main.zig
index 76f957456a..272187a9ed 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -1750,15 +1750,12 @@ fn buildOutputType(
}
const self_exe_path = try fs.selfExePathAlloc(arena);
- var zig_lib_directory: Compilation.Directory = if (override_lib_dir) |lib_dir|
- .{
- .path = lib_dir,
- .handle = try fs.cwd().openDir(lib_dir, .{}),
- }
- else
- introspect.findZigLibDirFromSelfExe(arena, self_exe_path) catch |err| {
- fatal("unable to find zig installation directory: {s}", .{@errorName(err)});
- };
+ var zig_lib_directory: Compilation.Directory = if (override_lib_dir) |lib_dir| .{
+ .path = lib_dir,
+ .handle = try fs.cwd().openDir(lib_dir, .{}),
+ } else introspect.findZigLibDirFromSelfExe(arena, self_exe_path) catch |err| {
+ fatal("unable to find zig installation directory: {s}", .{@errorName(err)});
+ };
defer zig_lib_directory.handle.close();
var thread_pool: ThreadPool = undefined;
@@ -2461,15 +2458,12 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v
}
}
- var zig_lib_directory: Compilation.Directory = if (override_lib_dir) |lib_dir|
- .{
- .path = lib_dir,
- .handle = try fs.cwd().openDir(lib_dir, .{}),
- }
- else
- introspect.findZigLibDirFromSelfExe(arena, self_exe_path) catch |err| {
- fatal("unable to find zig installation directory: {s}", .{@errorName(err)});
- };
+ var zig_lib_directory: Compilation.Directory = if (override_lib_dir) |lib_dir| .{
+ .path = lib_dir,
+ .handle = try fs.cwd().openDir(lib_dir, .{}),
+ } else introspect.findZigLibDirFromSelfExe(arena, self_exe_path) catch |err| {
+ fatal("unable to find zig installation directory: {s}", .{@errorName(err)});
+ };
defer zig_lib_directory.handle.close();
const std_special = "std" ++ fs.path.sep_str ++ "special";
@@ -3281,8 +3275,7 @@ pub const ClangArgIterator = struct {
self.zig_equivalent = clang_arg.zig_equivalent;
break :find_clang_arg;
},
- }
- else {
+ } else {
fatal("Unknown Clang option: '{s}'", .{arg});
}
}