Repository navigation
tools: DOOM speedrun libclang subset oracle, --clang PORTS (Part of #5468) - #5533
Merged
Merged
Conversation
…5468) doom_clang.py counts function definitions with libclang (preprocessor first, so macro-defined functions count) over a subset of ports, beside ctags and tree-sitter, never scored. Flags from compile_commands.json when present, else a guessed include path. Lazy import: without the libclang wheel the columns stay empty. Also: treesitter_counts returns a Counter when tree_sitter is absent (--oracle raised KeyError). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Owner
Author
|
No description provided. |
squid-protocol
marked this pull request as ready for review
October 18, 2026 20:49
squid-protocol
enabled auto-merge (squash)
October 18, 2026 20:51
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 #5468 (slice 3 of 4).
What
doom_speedrun.py score|run --clang PORTS(orall) adds a libclang function-definition count beside ctags and tree-sitter, on a subset of ports. libclang runs the preprocessor first, so macro-generated functions count (#5461). Never scored. Newdoom_clang.py: flags fromcompile_commands.json(orbuild/) when it lists the file, else-Ion the file's dir, repo root and every header dir (cap 300); counts definitions located in the file itself.libclang(PyPI wheel, bundles the .so) is imported lazily: without it the columns stay empty anddetails.jsonsays so. New CSV columns only with--clang:clang_files,clang_files_with_errors,clang_compile_commands_files,clang_functions,clang_gg_functions,clang_delta_pct.Also fixed:
treesitter_countsreturned a plain{}without tree_sitter, so--oracleraisedKeyError; it returns aCounternow.Real output (existing scans at engine
41777e5f4, libclang 18.1.1)Gaps are in platform code behind an inactive
#ifdef(e.g.i_winmusic.c: engine 51, clang 0); libclang counts only the active configuration. None of the 39 pinned repos ships acompile_commands.json, so the guessed include path is what ran. Agreement or disagreement is not correctness (README blind spots).Class sweep
Class: oracles for the function count. ctags (slice 1), tree-sitter (slice 1), libclang (this PR): covered. libclang covers C/C++ only. Sibling gaps: none beyond the class (no compiler-grade oracle exists for the other languages in the manifest; Roslyn/javac/rustc are out of scope). Remaining slice: 4/4, PR body results table / docs.
Files (5 hand-written):
doom_clang.py(new),doom_scorer.py,doom_speedrun.py,README.md,tests/tools/test_doom_speedrun.py. Branched off main, not off #5529 (slice 2):doom_speedrun.py,README.mdand the test file will conflict textually with it; whichever merges second merges main.Gates
pr_gates --fast6/6; tree-wide guards +test_doom_speedrun.py196 passed 1 skipped locally; with libclang on PYTHONPATH all 18 doom tests pass (the clang testimportorskips, so CI skips it: nolibclangin CI deps). Time ratchet 0 over.--ratchetsnot run: tool-only, no parsing logic touched.Lessons for agents
tree_sitter_language_packabsent madedoom_scorer.treesitter_countsreturn a plain dict and--oraclecrash; useCounterfor count maps that are summed by key.🤖 Generated with Claude Code