aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-07-19 09:36:57 -0700
committerGitHub <noreply@github.com>2023-07-19 09:36:57 -0700
commit0aacb6369fdf3762b7ab6069955684abb63f1459 (patch)
tree8a84783f2dd008e3e0aef59cbe6b9ad0e36c0831 /src/Compilation.zig
parent70c71935c7c9f20353dc2a50b497b752d70d3452 (diff)
parentd5d067211b55a9afbbe3ac52daa0f09d37e5f335 (diff)
downloadzig-0aacb6369fdf3762b7ab6069955684abb63f1459.tar.gz
zig-0aacb6369fdf3762b7ab6069955684abb63f1459.zip
Merge pull request #16318 from ziglang/rework-generics
rework generic function calls
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 91747e8b01..eb4b67933d 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -29,6 +29,7 @@ const wasi_libc = @import("wasi_libc.zig");
const fatal = @import("main.zig").fatal;
const clangMain = @import("main.zig").clangMain;
const Module = @import("Module.zig");
+const InternPool = @import("InternPool.zig");
const BuildId = std.Build.CompileStep.BuildId;
const Cache = std.Build.Cache;
const translate_c = @import("translate_c.zig");
@@ -227,7 +228,8 @@ const Job = union(enum) {
/// Write the constant value for a Decl to the output file.
codegen_decl: Module.Decl.Index,
/// Write the machine code for a function to the output file.
- codegen_func: Module.Fn.Index,
+ /// This will either be a non-generic `func_decl` or a `func_instance`.
+ codegen_func: InternPool.Index,
/// Render the .h file snippet for the Decl.
emit_h_decl: Module.Decl.Index,
/// The Decl needs to be analyzed and possibly export itself.
@@ -2053,15 +2055,9 @@ pub fn update(comp: *Compilation, main_progress_node: *std.Progress.Node) !void
const decl = module.declPtr(decl_index);
assert(decl.deletion_flag);
assert(decl.dependants.count() == 0);
- const is_anon = if (decl.zir_decl_index == 0) blk: {
- break :blk module.namespacePtr(decl.src_namespace).anon_decls.swapRemove(decl_index);
- } else false;
+ assert(decl.zir_decl_index != 0);
try module.clearDecl(decl_index, null);
-
- if (is_anon) {
- module.destroyDecl(decl_index);
- }
}
try module.processExports();
@@ -3216,8 +3212,7 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v
// Tests are always emitted in test binaries. The decl_refs are created by
// Module.populateTestFunctions, but this will not queue body analysis, so do
// that now.
- const func_index = module.intern_pool.indexToFunc(decl.val.ip_index).unwrap().?;
- try module.ensureFuncBodyAnalysisQueued(func_index);
+ try module.ensureFuncBodyAnalysisQueued(decl.val.toIntern());
}
},
.update_embed_file => |embed_file| {