@@ -1947,6 +1947,20 @@ const AfterUpdateHook = union(enum) {
1947
1947
fn updateModule (gpa : * Allocator , comp : * Compilation , zir_out_path : ? []const u8 , hook : AfterUpdateHook ) ! void {
1948
1948
try comp .update ();
1949
1949
1950
+ if (zir_out_path ) | zop | {
1951
+ const module = comp .bin_file .options .module orelse
1952
+ fatal ("-femit-zir with no zig source code" , .{});
1953
+ var new_zir_module = try zir .emit (gpa , module );
1954
+ defer new_zir_module .deinit (gpa );
1955
+
1956
+ const baf = try io .BufferedAtomicFile .create (gpa , fs .cwd (), zop , .{});
1957
+ defer baf .destroy ();
1958
+
1959
+ try new_zir_module .writeToStream (gpa , baf .stream ());
1960
+
1961
+ try baf .finish ();
1962
+ }
1963
+
1950
1964
var errors = try comp .getAllErrorsAlloc ();
1951
1965
defer errors .deinit (comp .gpa );
1952
1966
@@ -1966,19 +1980,7 @@ fn updateModule(gpa: *Allocator, comp: *Compilation, zir_out_path: ?[]const u8,
1966
1980
),
1967
1981
}
1968
1982
1969
- if (zir_out_path ) | zop | {
1970
- const module = comp .bin_file .options .module orelse
1971
- fatal ("-femit-zir with no zig source code" , .{});
1972
- var new_zir_module = try zir .emit (gpa , module );
1973
- defer new_zir_module .deinit (gpa );
1974
1983
1975
- const baf = try io .BufferedAtomicFile .create (gpa , fs .cwd (), zop , .{});
1976
- defer baf .destroy ();
1977
-
1978
- try new_zir_module .writeToStream (gpa , baf .stream ());
1979
-
1980
- try baf .finish ();
1981
- }
1982
1984
}
1983
1985
1984
1986
fn cmdTranslateC (comp : * Compilation , arena : * Allocator , enable_cache : bool ) ! void {
0 commit comments