Skip to content

cpp: index C++ via tree-sitter-cpp, keep .h on C - #100

Open
SquisherDerHeld wants to merge 1 commit into
facebookexperimental:mainfrom
SquisherDerHeld:cpp/index-via-tree-sitter-cpp
Open

SquisherDerHeld wants to merge 1 commit into
facebookexperimental:mainfrom
SquisherDerHeld:cpp/index-via-tree-sitter-cpp

Conversation

@SquisherDerHeld

@SquisherDerHeld SquisherDerHeld commented Oct 13, 2026 •

Copy link
Copy Markdown

Indexes C++ sources with tree-sitter-cpp. Files with cpp, cc, cxx, hpp and similar extensions use the C++ grammar; .h stays on C.

Methods store under one lookup key whether defined in class or out of class (~E and E::~E both store as E::~E), template arguments are dropped from keys (Box<T>::get → Box::get), and macro values are re-parsed with the file's own grammar so calls like ns::helper() inside a #define are recorded.

C++ is not on by default; index it with --extensions cpp,h.

Tests: tests/cpp_indexing.rs.

@meta-cla

meta-cla Bot commented Oct 13, 2026

Copy link
Copy Markdown

Hi @SquisherDerHeld!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@SquisherDerHeld

Copy link
Copy Markdown
Author

@facebook-github-bot recheck

@SquisherDerHeld
SquisherDerHeld force-pushed the cpp/index-via-tree-sitter-cpp branch from 6d48149 to 0cd443b Compare October 13, 2026 19:23
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 13, 2026
@SquisherDerHeld

Copy link
Copy Markdown
Author

This PR is purely AI, all changes look reasonable but I did not look into it too deeply. It just enabled me to index a cpp project

@SquisherDerHeld
SquisherDerHeld force-pushed the cpp/index-via-tree-sitter-cpp branch from 0cd443b to 56c6b10 Compare October 13, 2026 19:37
cpp, cc, cxx, hpp and similar extensions use the C++ grammar; .h
stays on C. Methods store under one lookup key whether defined in
class or out of class (~E and E::~E both store as E::~E), template
arguments are dropped from keys (Box<T>::get stores as Box::get), and
macro values are re-parsed with the file's own grammar so calls like
ns::helper() inside a #define are recorded.

C++ is not on by default; index it with --extensions cpp,h. Tests in
tests/cpp_indexing.rs.
@SquisherDerHeld
SquisherDerHeld force-pushed the cpp/index-via-tree-sitter-cpp branch from 56c6b10 to cf08271 Compare October 13, 2026 19:55
@rikvanriel

Copy link
Copy Markdown
Contributor

I'm still in the middle of adding proper object oriented language support to the semcode database, so we can handle things like building a call chain through a code base that has multiple functions of the same name, but in different classes.

I'll take a look at whether your approach on how to add C++ can handle the different corner cases that are needed for full support, or whether we need something else.

If we merely need "more", but we do not need to fundamentally change what you did, I'll try to merge this soon. If it turns out we need a different approach for some corner case reason, I'll get to that over time.

This branch has not been deployed

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

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants