Repository navigation
Commit 7ecc6cd
Move Function::GetComplexity implementation into the core, add Rust bindings
Function::GetComplexity/GetComplexityMetricNames now call through new
BNGetFunctionComplexity/BNGetFunctionComplexityMetricNames C API
functions instead of each language binding reimplementing the metric
engine independently - the core is now the single canonical C/C++
implementation. Also adds "code_references" (count of code
cross-references to a function - the complement of fan_out) to the
core implementation, and adds Rust bindings
(Function::complexity/complexity_metric_names) that go through the
same C API.
The standalone complexity.cpp in this repo is removed since its logic
moved into the core; the C++ wrapper in function.cpp now validates the
metric name client-side before calling into the core, since the C ABI
boundary can't let an unrecognized-metric exception cross into other
language bindings (notably Rust).
Validated directly: a full incremental build of the real Binary Ninja
core links successfully with the new BNGetFunctionComplexity/
BNGetFunctionComplexityMetricNames symbols correctly exported: nm
confirms both. The updated C++ wrapper in function.cpp syntax-checks
cleanly against the new declarations, and `cargo check` on the Rust
crate passes with bindgen picking up the new C API automatically.
Corresponding core changes (core/complexity.cpp, a small addition to
core/function.h) live in the separate, private binaryninja core repo
and aren't part of this PR - flagging here since this PR's C++/Rust
code won't link without them.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 8662f74 commit 7ecc6cd
4 files changed
Lines changed: 79 additions & 490 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6025 | 6025 | | |
6026 | 6026 | | |
6027 | 6027 | | |
| 6028 | + | |
| 6029 | + | |
| 6030 | + | |
| 6031 | + | |
| 6032 | + | |
| 6033 | + | |
| 6034 | + | |
| 6035 | + | |
| 6036 | + | |
| 6037 | + | |
| 6038 | + | |
6028 | 6039 | | |
6029 | 6040 | | |
6030 | 6041 | | |
| |||
0 commit comments