Branch: refs/heads/topic/robin/gh-2325-canon-ids
Home:
https://github.com/zeek/spicy
Commit: aef172c2bfa740f41325b2759742b80bcd0c3a4c
https://github.com/zeek/spicy/commit/aef172c2bfa740f41325b2759742b80bcd0c3a4c
Author: Robin Sommer <
ro...@corelight.com>
Date: 2026-06-26 (Fri, 26 Jun 2026)
Changed paths:
M hilti/toolchain/src/compiler/resolver.cc
Log Message:
-----------
Link free-function implementations to their prototypes.
When a free function is declared separately from its implementation,
the resolver now links the implementation to its prototype.
Previously, we did this only for methods, which means AST consumers
had to handle free functions themselves.
Commit: 09c092a9733e77d4bd6d9b1b1fe7437ee1607e4b
https://github.com/zeek/spicy/commit/09c092a9733e77d4bd6d9b1b1fe7437ee1607e4b
Author: Robin Sommer <
ro...@corelight.com>
Date: 2026-06-26 (Fri, 26 Jun 2026)
Changed paths:
M hilti/toolchain/include/ast/declarations/function.h
M hilti/toolchain/include/compiler/detail/optimizer/optimizer.h
M hilti/toolchain/src/ast/declarations/function.cc
M hilti/toolchain/src/compiler/optimizer/passes/dead-code-static.cc
M hilti/toolchain/src/compiler/optimizer/passes/propagate-function-returns.cc
M hilti/toolchain/src/compiler/optimizer/passes/remove-unused-fields.cc
M hilti/toolchain/src/compiler/optimizer/passes/remove-unused-params.cc
Log Message:
-----------
Inside optimizer, index per-function state by canonical ID.
We were using `fullyQualifiedId()`, which isn't unique across module
imports: separate functions can have the same FQID inside a single
AST.
To facilitate the switch, we replace
`declaration::Function::functionID()` with ``Optimizer::functionID()`
that returns a function/method's canonical ID but follows any linked
declarations to its prototype before doing so. That way, it returns an
ID that's suitable to use as an index inside optimizer passes to store
state per function.
We then use that consistently across the optimizer.
Couple related tweaks included:
- `dead-code-static` now resolves `MemberCall` targets via
`op.declaration()` instead of `type::Struct::field(id)`, which only
returned the first matching field and masked overload bugs.
- `remove-unused-params` skips parameter removal when a struct has
overloaded methods of the same name, since stripping unused
parameters under canonical ID keys can collapse overloads to
identical signatures.
Compare:
https://github.com/zeek/spicy/compare/516f9871b427...09c092a9733e
To unsubscribe from these emails, change your notification settings at
https://github.com/zeek/spicy/settings/notifications