Prefilter plain C headers before C++ parsing - #876
Open
yzxcj797 wants to merge 1 commit into
Open
Conversation
code-review-graph reviewOverall risk: 0.40 (MEDIUM) — 8 changed function(s)/class(es), 0 affected flow(s), 2 test gap(s) Risk-scored changes
Test gaps
Token savings: this graph-backed report used ~162,901 fewer tokens (~99%) than reading every changed file in full (estimated, chars/4 approximation). Powered by code-review-graph — local-first analysis; no code leaves the CI runner. |
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.
Summary
Header promotion introduced two throughput costs for plain C repositories:
.hfile paid a speculative tree-sitter-cpp parse;This change adds cheap source-level prefilters:
.hfiles are only speculatively parsed as C++ when they contain textual evidence such asclass,namespace,template,::,constexpr,noexcept, or a trailing return arrow;Q_norQT_.Qt/C++ behavior is unchanged when those signals are present.
Fixes #802.
Testing
pytest tests/test_pr802_cpp_prefilter.py tests/test_cpp_qt_headers.py -q— 17 passedruff checkon changed files — passesgit diff --check— passes