Skip to content

feat: add C and C++ cross-reference parsing#100

Open
liumuqing wants to merge 1 commit into
johnhuang316:masterfrom
liumuqing:feat/c-cpp-cross-references
Open

feat: add C and C++ cross-reference parsing#100
liumuqing wants to merge 1 commit into
johnhuang316:masterfrom
liumuqing:feat/c-cpp-cross-references

Conversation

@liumuqing

Copy link
Copy Markdown

First, thank you for building and maintaining this project. I really like code-index-mcp and have been using this MCP in my own workflow; it is genuinely useful for navigating and understanding codebases.

This PR adds specialized C/C++ parsing support to the deep index pipeline.

Summary:

  • Add a tree-sitter based C/C++ parsing strategy.
  • Parse .c and .h files as C, and .cpp/.cc/.cxx/.hpp/.hh/.hxx files as C++.
  • Extract includes, functions, structs, unions, enums, C++ classes, namespaces, and methods.
  • Record same-file and cross-file call relationships through the existing called_by / pending_calls flow.
  • Categorize struct/union/enum/interface symbols in file summaries so they appear with class-like type symbols.
  • Add strategy-level and SQLite deep-index tests for C/C++ symbols and cross-file calls.

Validation:

  • uv run --with pytest pytest tests/strategies tests/indexing/test_c_cpp_called_by.py tests/indexing/test_sqlite_index_builder.py tests/indexing/test_javascript_called_by.py tests/indexing/test_typescript_called_by.py tests/indexing/test_rust_deep_index.py
  • 25 passed

I also smoke-tested this against Linux kernel subtrees under /Volumes/Code/linux, including init and kernel/sched, and verified that C headers, structs, functions, and cross-file called_by relationships are populated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant