feat(graph): C/C++ file detection and tree-sitter parsing foundation#668
Open
shivasurya wants to merge 1 commit intomainfrom
Open
feat(graph): C/C++ file detection and tree-sitter parsing foundation#668shivasurya wants to merge 1 commit intomainfrom
shivasurya wants to merge 1 commit intomainfrom
Conversation
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep Github App |
|
|
Code Pathfinder Security ScanNo security issues detected.
Powered by Code Pathfinder |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #668 +/- ##
=======================================
Coverage 85.06% 85.07%
=======================================
Files 172 173 +1
Lines 25027 25070 +43
=======================================
+ Hits 21290 21329 +39
- Misses 2941 2944 +3
- Partials 796 797 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9690595 to
caf0fec
Compare
Route .c/.cpp/.cc/.cxx/.h/.hpp/.hh/.hxx files to the C and C++ tree-sitter grammars and exclude common C/C++ build artifact directories (build/, cmake-build-*, third_party/, external/, obj/, bin/, dist/, .cache/) during file discovery. Header files share the .h extension between C and C++. A best-effort heuristic scans the first 100 lines for C++-only indicators (class, namespace, template, access specifiers, ::) and the result is cached in a sync.Map populated once per file in the initialize.go worker before AST traversal, so the per-AST-node IsCSourceFile / IsCppSourceFile lookups stay zero-I/O. The C/C++ detection helpers live in a new graph/clike/ subpackage that sits alongside the existing graph/golang, graph/python, graph/java, and graph/docker packages. graph/clike will accumulate the shared C/C++ extraction primitives in subsequent PRs (parser, type strings, parameter extraction); this PR introduces detection only. This is parsing-pipeline groundwork only — no AST → Node dispatch yet, so existing Java/Python/Go behavior is unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
caf0fec to
0f553a6
Compare
10 tasks
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
Foundation for C/C++ language support — file discovery and tree-sitter
grammar selection only. No AST → Node dispatch yet, so Java/Python/Go
behavior is unchanged.
.c,.cpp,.cc,.cxx,.h,.hpp,.hh,.hxxfiles tothe C and C++ tree-sitter grammars
getFiles():build/,cmake-build-*,third_party/,external/,obj/,bin/,dist/,.cache/.hheaders as C vs C++ via a best-effort heuristic(first ~100 lines scanned for
class,namespace,template<,access specifiers,
::)sync.Mappopulated once per file inthe
initialize.goworker before AST traversal — keeps the per-nodeIsCSourceFile/IsCppSourceFilelookups zero-I/OPackage layout
C/C++ helpers live in a new
graph/clike/subpackage that sits alongsidethe existing language siblings:
Subsequent PRs will add
graph/clike/parser.go, type-string extraction,and parameter extraction in the same package, mirroring the layout of
graph/golang/.Test plan
go build ./...— cleango vet ./...— cleangolangci-lint run ./graph/...— 0 issuesgo test ./graph/... -count=1— passes (no Java/Python/Go regressions)graph/clike/detection_test.go:TestIsCSourceFile/TestIsCppSourceFile— every extension + cached/uncached.hTestDetectCppInHeader— pure C, class, namespace, template,::,extern "C", empty, missing-filegraph/utils_test.go::TestGetFilesIncludesCAndCpp— verifies inclusion of C/C++ extensions and exclusion of all build/artifact dirs