Repository navigation
fix(discover): select C++ for C-family .inc fragments - #2826
knewstimek wants to merge 2 commits into
Conversation
Recognize explicit C-family code in .inc files before extraction while preserving BitBake recipe bodies and ObjectScript markers. Exercise disk and byte classifiers, callback/linkage extraction and fast/full indexing. Signed-off-by: knewstimek <knewstimek@users.noreply.github.com>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
|
Thank you very much for this fix, @knewstimek, and for filing #2825 with such a clear synthetic reproduction first. We have reviewed it and measured it on real code. On 294 .inc files from LLVM, compiler-rt, the .NET runtime and the Linux kernel, your classifier moves about 100 to C++, and the large majority really are C/C++: 60 of them could not be parsed at all before, and the graph gains real functions, methods, macros and call edges for them. Both of your routing tests fail on main for the right reason and pass with your change. Another pull request (#2421) landed on main tonight and also edits src/discover/language.c and discover.h, so we merged current main into your branch (one merge commit, d841ddd; it merged cleanly and your own change is untouched) to get a CI run against today's main. We will follow up here once that run is through. Please pull before pushing again. |
C/C++
.incfragments currently reach the BitBake or ObjectScript grammar, so normal C++ linkage declarations and function definitions can disappear from the graph. Recognize explicit C-family code and select the C++ grammar before extraction.Closes #2825
The existing 4 KiB content probe is retained, and byte-based classification and disk discovery still share
lang_inc_text. Leading C comments are skipped; BitBake assignments and shell/Python task bodies are recognized before embedded C-like text. Explicit ObjectScript markers retain precedence, a lone#defineretains its existing ObjectScript fallback, and unknown/unreadable content retains BitBake.Tests use synthetic identifiers only and cover the byte classifier, both disk entry points, linkage/callback extraction, and actual fast/full pipeline indexing. This changes grammar selection; it does not reconstruct the enclosing function at an include site or promise arbitrary external-header macro expansion. Runtime coordination, schemas, public tools, and dependencies are unchanged.
Validation on Windows x64 with LLVM-MinGW/Clang 23:
scripts/test.sh --suites language,extraction BUILD_DIR=r CC=clang CXX=clang++ CXX_STDLIB=-lc++ SANITIZE=: 743 passed (local zlib paths supplied through the environment).CBM_TEST_ONLY=pipeline:pipeline_inc_c_family_fragments r/test-runner pipeline: 1 passed, exercising fast and full modes.git diff --checkpassed.scripts/lint.sh --ciwas attempted, but this host lacks cppcheck and its formatter reports differences in existing untouched files. Linux and sanitizer validation are left to CI.Related work checked: #467 introduced the current BitBake/ObjectScript routing; #778 is PHP/Drupal extension support; #2629 is raw/preprocessed-definition deduplication. No equivalent C-family
.incrouting fix was found among the searched open and closed issues/PRs.AI-assisted implementation and verification with Codex.