Files
codegraph/__tests__
Aaron QueenandClaude Opus 5.5 c30696703d fix(cfnptr): a C function-pointer table links only to C and C++ functions
resolveFn in the C function-pointer pass looked a registered handler's
name up across every language, filtered only to function and method
kinds. In a repository that also holds Rust or Python, a C table could
link to a same-named Rust or Python function, and when that function
sorted first it also took the place of the real C handler.

The fix keeps candidates in C and C++ files only, using the pass's own
C_CPP_EXT, the file set it scans for tables and dispatch. Headers the
language detector labels Objective-C still count. Objective-C `.m` and
`.mm` files stay out, like they are out of the scan: a table in a `.m`
file is never read, and allowing them would let an Objective-C method
named `init` or `read` stand in for a C handler of that name.
On GLFW, which mixes C and Objective-C, main links 354 table entries,
none into a .m file; its one C table naming a .m function
(_glfwConnectCocoa) is an anonymous-struct table the pass doesn't
bridge on main either.

Validation, main b6379e6d vs this:
- c-fnptr-synthesizer.test.ts: the new case fails on main (impl_read
  links to aaa/gen.py) and passes here; 19/19.
- Linux d135ab45 subtree (rust/, drivers/android, drivers/base,
  drivers/net/dsa, fs, tools/net, include/linux; 6,580 files):
  byte-identical, 12,244 fn-pointer-dispatch edges, all into C or C++
  files on both arms. Main links none of this tree into Rust or Python,
  so the PR's 193 (a whole-kernel index on its fork) don't show here; a subtree holding its three example sites (pmcraid's
  `->reset_cmd = cmd`, afs's `->update_time = new`, map.c's
  `p->lock = lock`) has none either, since a plain assignment of a
  variable doesn't register on main.
- C and C++ controls byte-identical (dump-graph, every table): redis
  7f440372 (863 fn-pointer-dispatch edges), GLFW 92dcf4ce (354), jq
  49fbca12 and leveldb 7ee830d0.
- The resolver change is TS-side; the kernel ports only the per-file
  sweep, so both engines take the same edges. kernel-parity on the
  kernel's drivers/base, drivers/net/dsa and drivers/android (279 C
  files): 240 at parity, 0 diffs, 39 deferred to wasm by policy.

Ours on top: the CHANGELOG bullet moved from the released 1.6.1
section to Unreleased and reworded.

Original PR #1989 by @bompus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 18:57:30 +00:00
..