diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-05-29 23:41:40 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-29 23:41:40 -0700 |
| commit | 22b0457dd4b73d3cce2e52b77b3b7c9f857c0409 (patch) | |
| tree | 111e73c005fa6fcdbc7157f0133b69cbf790a4bf /src/Compilation.zig | |
| parent | ac9f72d87e8eeb4a9d0dead80b61420485279ddd (diff) | |
| parent | 0f58d34ef7935dd9877f4969ed6ec7d582cd104c (diff) | |
| download | zig-22b0457dd4b73d3cce2e52b77b3b7c9f857c0409.tar.gz zig-22b0457dd4b73d3cce2e52b77b3b7c9f857c0409.zip | |
Merge pull request #15891 from mlugg/fix/dont-emit-fn-called-at-comptime
Prevent analysis of functions only referenced at comptime
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 2ab9dde35c..30d825b9c6 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -3199,6 +3199,13 @@ fn processOneJob(comp: *Compilation, job: Job, prog_node: *std.Progress.Node) !v error.OutOfMemory => return error.OutOfMemory, error.AnalysisFail => return, }; + const decl = module.declPtr(decl_index); + if (decl.kind == .@"test" and comp.bin_file.options.is_test) { + // 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. + try module.ensureFuncBodyAnalysisQueued(decl.val.castTag(.function).?.data); + } }, .update_embed_file => |embed_file| { const named_frame = tracy.namedFrame("update_embed_file"); |
