stage2: fix crash using -femit-bin

This commit is contained in:
Andrew Kelley 2022-02-17 13:12:31 -07:00
parent 63cbec1a96
commit f20929bd8b
2 changed files with 7 additions and 1 deletions

View File

@ -2771,6 +2771,8 @@ fn processOneJob(comp: *Compilation, job: Job, main_progress_node: *std.Progress
sema_frame.end();
sema_frame_ended = true;
if (comp.bin_file.options.emit == null) return;
const liveness_frame = tracy.namedFrame("liveness");
var liveness_frame_ended = false;
errdefer if (!liveness_frame_ended) liveness_frame.end();

View File

@ -5266,7 +5266,11 @@ pub fn populateTestFunctions(mod: *Module) !void {
}
pub fn linkerUpdateDecl(mod: *Module, decl: *Decl) !void {
mod.comp.bin_file.updateDecl(mod, decl) catch |err| switch (err) {
const comp = mod.comp;
if (comp.bin_file.options.emit == null) return;
comp.bin_file.updateDecl(mod, decl) catch |err| switch (err) {
error.OutOfMemory => return error.OutOfMemory,
error.AnalysisFail => {
decl.analysis = .codegen_failure;