aboutsummaryrefslogtreecommitdiff
path: root/src-self-hosted
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-05-13 22:20:31 -0400
committerAndrew Kelley <andrew@ziglang.org>2020-05-13 22:20:31 -0400
commitfb947c365e95298a4619b8db2c0d40b9d69172f2 (patch)
treecaa5e09bc4c49c8933cce43928fed0320ffc342b /src-self-hosted
parent6a2425c38c2a776d2aafd68b25da8c4c1164f614 (diff)
downloadzig-fb947c365e95298a4619b8db2c0d40b9d69172f2.tar.gz
zig-fb947c365e95298a4619b8db2c0d40b9d69172f2.zip
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!
Diffstat (limited to 'src-self-hosted')
-rw-r--r--src-self-hosted/ir.zig30
1 files changed, 17 insertions, 13 deletions
diff --git a/src-self-hosted/ir.zig b/src-self-hosted/ir.zig
index d7a2228f74..6efc3cdbc3 100644
--- a/src-self-hosted/ir.zig
+++ b/src-self-hosted/ir.zig
@@ -697,16 +697,9 @@ pub const Module = struct {
};
}
- fn analyzeRoot(self: *Module, root_scope: *Scope.ZIRModule) !void {
- // TODO use the cache to identify, from the modified source files, the decls which have
- // changed based on the span of memory that represents the decl in the re-parsed source file.
- // Use the cached dependency graph to recursively determine the set of decls which need
- // regeneration.
- // Here we simulate adding a source file which was previously not part of the compilation,
- // which means scanning the decls looking for exports.
- // TODO also identify decls that need to be deleted.
- const src_module = switch (root_scope.status) {
- .unloaded => blk: {
+ fn getTextModule(self: *Module, root_scope: *Scope.ZIRModule) !*text.Module {
+ switch (root_scope.status) {
+ .unloaded => {
try self.failed_files.ensureCapacity(self.failed_files.size + 1);
var keep_source = false;
@@ -743,12 +736,23 @@ pub const Module = struct {
root_scope.contents = .{ .module = zir_module };
keep_zir_module = true;
- break :blk zir_module;
+ return zir_module;
},
.unloaded_parse_failure, .loaded_parse_failure => return error.AnalysisFail,
- .loaded_success => root_scope.contents.module,
- };
+ .loaded_success => return root_scope.contents.module,
+ }
+ }
+
+ fn analyzeRoot(self: *Module, root_scope: *Scope.ZIRModule) !void {
+ // TODO use the cache to identify, from the modified source files, the decls which have
+ // changed based on the span of memory that represents the decl in the re-parsed source file.
+ // Use the cached dependency graph to recursively determine the set of decls which need
+ // regeneration.
+ // Here we simulate adding a source file which was previously not part of the compilation,
+ // which means scanning the decls looking for exports.
+ // TODO also identify decls that need to be deleted.
+ const src_module = try self.getTextModule(root_scope);
// Here we ensure enough queue capacity to store all the decls, so that later we can use
// appendAssumeCapacity.