authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-05-13 22:20:31-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-05-13 22:20:31-04:00
logfb947c365e95298a4619b8db2c0d40b9d69172f2
treecaa5e09bc4c49c8933cce43928fed0320ffc342b
parent6a2425c38c2a776d2aafd68b25da8c4c1164f614

work around stage1 compiler bug

breaking from inside the block with defers in scope triggered broken LLVM module found: Terminator found in the middle of a basic block!

1 files changed, 17 insertions(+), 13 deletions(-)

src-self-hosted/ir.zig+17-13
......@@ -697,16 +697,9 @@ pub const Module = struct {
697697 };
698698 }
699699
700 fn analyzeRoot(self: *Module, root_scope: *Scope.ZIRModule) !void {
701 // TODO use the cache to identify, from the modified source files, the decls which have
702 // changed based on the span of memory that represents the decl in the re-parsed source file.
703 // Use the cached dependency graph to recursively determine the set of decls which need
704 // regeneration.
705 // Here we simulate adding a source file which was previously not part of the compilation,
706 // which means scanning the decls looking for exports.
707 // TODO also identify decls that need to be deleted.
708 const src_module = switch (root_scope.status) {
709 .unloaded => blk: {
700 fn getTextModule(self: *Module, root_scope: *Scope.ZIRModule) !*text.Module {
701 switch (root_scope.status) {
702 .unloaded => {
710703 try self.failed_files.ensureCapacity(self.failed_files.size + 1);
711704
712705 var keep_source = false;
......@@ -743,12 +736,23 @@ pub const Module = struct {
743736 root_scope.contents = .{ .module = zir_module };
744737 keep_zir_module = true;
745738
746 break :blk zir_module;
739 return zir_module;
747740 },
748741
749742 .unloaded_parse_failure, .loaded_parse_failure => return error.AnalysisFail,
750 .loaded_success => root_scope.contents.module,
751 };
743 .loaded_success => return root_scope.contents.module,
744 }
745 }
746
747 fn analyzeRoot(self: *Module, root_scope: *Scope.ZIRModule) !void {
748 // TODO use the cache to identify, from the modified source files, the decls which have
749 // changed based on the span of memory that represents the decl in the re-parsed source file.
750 // Use the cached dependency graph to recursively determine the set of decls which need
751 // regeneration.
752 // Here we simulate adding a source file which was previously not part of the compilation,
753 // which means scanning the decls looking for exports.
754 // TODO also identify decls that need to be deleted.
755 const src_module = try self.getTextModule(root_scope);
752756
753757 // Here we ensure enough queue capacity to store all the decls, so that later we can use
754758 // appendAssumeCapacity.