cl: llgoSupportAliasAsRecv = true; cl compileFuncOrMethod: support method with callback - #880
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #880 +/- ##
==========================================
- Coverage 88.36% 88.04% -0.33%
==========================================
Files 22 22
Lines 1857 1857
==========================================
- Hits 1641 1635 -6
- Misses 216 222 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Review: enable methods for callback funcs & alias receivers
The functional change in cl/func.go is small and coherent, and the regenerated tool/_testc/clang-c-22.1.8/* fixtures consistently reflect the new output (value receivers like VirtualFileOverlay replacing pointer-receiver impl types, with matching llgo:link directives).
What the change does
- Drops the
feats&featHasCallback == 0guard (and its TODO) so C global functions with callback parameters can now be converted to methods. - Flips
llgoSupportAliasAsRecvfromfalsetotrue, enabling alias types as method receivers.
Verified as safe/non-issues
featHasCallbackis still detected and used incl/type.goandcl/typedef.go; removing its use as a gate here orphans no symbol.- The real safety gate — the
featIgnoredearly-return — still runs first, so no unsupported type slips through. - No performance regression:
featsis fully computed before the branch regardless, and the newly-taken alias branch is strictly cheaper than the old one. - No security/trust-boundary impact: this is a compile-time generator over developer-supplied headers; type identity and linkname targets are unchanged.
Main finding — see the inline comment: flipping llgoSupportAliasAsRecv to a const true leaves the else branch in tryToMethod (lines ~228-242) statically unreachable dead code. That dead branch is also the only in-code writer of ctx.typeAbbr (lines 238-239), so the previous auto-registration of alias-type abbreviations no longer happens at runtime (ctx.typeAbbr is still read at cl/ctx.go:337 and populated from config at cl/compile.go:217). Please confirm dropping that auto-population is intentional.
Uh oh!
There was an error while loading. Please reload this page.