zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 5746beb8224e6e3c5d71d93a4a9c5741daebebf6 (tree)
parent e573d8e8d60e597bf166d08ce93e321c0e60c108
Author: Motiejus Jakštys <motiejus@jakstys.lt>
Date:   Tue, 24 Feb 2026 00:10:36 +0000

sema: skip cross-module callee body analysis

Cross-module function bodies belong to the imported module's AIR output,
not the current file's. Analyzing them in the current context produces
spurious function entries (e.g. ve_endian from native_endian resolution)
that don't appear in the precomputed Zig AIR data.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Diffstat:
Mstage0/sema.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/stage0/sema.c b/stage0/sema.c @@ -4469,8 +4469,11 @@ static AirInstRef zirCall( // Ported from Sema.zig analyzeCall: ensureFuncBodyAnalysisQueued. // For generic functions, pass call args so comptime params are // mapped to their resolved values (monomorphization). - analyzeFuncBodyAndRecord(sema, block, func_inst, callee_name_idx, - is_generic ? arg_refs : NULL, is_generic ? args_len : 0); + // Skip for cross-module calls: their function bodies belong to + // the imported module's AIR, not the current file's. + if (!is_cross_module) + analyzeFuncBodyAndRecord(sema, block, func_inst, callee_name_idx, + is_generic ? arg_refs : NULL, is_generic ? args_len : 0); // Clean up cross-module state. if (is_cross_module) {