Repository navigation
DOOM call-graph: libclang reference on the C ports (Part of #5630) - #6766
Merged
Merged
Conversation
…py); clang_callgraph reports fatal-error files (Part of #5630) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
|
No description provided. |
Contributor
|
No description provided. |
Contributor
|
No description provided. |
Contributor
|
No description provided. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #5630 (step 4; #3784's C reference is the instrument).
What
tests/tools/doom_speedrun/doom_clang_calls.pycompares libclang's resolved call graph (tests/tools/clang_callgraph.py, preprocessor first) with the engine'scalls_out_toon the 15 licensed C ports, by (file, caller), both sides restricted to repo-defined names, self-edges and vendored files dropped. Reported to<work>/results/<sha>/clang_calls.json, never scored.clang_callgraph.buildnow returnsfatal(sources whose parse hit a fatal error), only when non-empty so other readers of the contract are unchanged.Evidence (libclang 18.1.1, scans at 590c805, ~4 min for all 15)
The clones have no build, so almost every file hits a fatal include error (
config.h,SDL.h); clang then guesses types and can lose a call to a function of its own file (chocolate-doomopl.cAutoSelectDriver -> InitDriveris a real call clang drops). So the low precision is mostly the reference's blind spot, which is why the clean-file count is kept apart. Read: a lead, not a verdict.Real lead from the clean files: a call made only through a function-like macro (
#define FTOM(x) FixedMul(...), used inAM_Responder) is seen by the compiler and missed by the engine (puredoom and chocolate-doomam_map.c,FixedMulx6+ each). Other clean-file disagreements are header-defined static functions the reference attributes per translation unit (woofp_saveg.h, doomretrom_array.h, inter-doomstb_image_write.h).Gates:
pr_gates --fast9/9; tests: new 5 +test_callgraph_tools,test_callgraph_oracle,test_doom_speedrun, tree-wide guards, 302 passed. Ratchets 9/9. No engine change, so no golden re-bless.Class / Sibling gaps
Class: "compiler-resolved call edges the engine's text rules cannot see or invent", measured per C port. Members: all 15 licensed C ports run (table). C++ ports (eternity, gzdoom, odamex, edge-classic, doom3-bfg, doomsday, srb2): not run, the C reference reads
.conly; the C++ reference (clang_callgraph.py ... cpp) needs system includes and its own comparer by qualified name (Sibling gap). Macro-expanded calls (FTOM -> FixedMul): an engine gap, different mechanism (macro-body resolution in the detector), not done here. Header-defined static functions in the reference (per-TU attribution): reference-side, not done here.Remaining slices
am_map.cis the pin case).callgraph_baseline.jsonwith a--clangswitch oncallgraph_oracle.py(needs a build-less include stub to cut the fatal-error noise first).clang_callgraph.py cpp.Lessons for agents
clang_callgraph.pyanddoom_clang_calls.pyneed the selfscan venv python: the system python has noclang, andbuildexits with an install hint.config.h,SDL.h): never drop those files wholesale (it empties the comparison); count them apart.🤖 Generated with Claude Code