Skip to content
cd /languages
  • Large-scale native
  • Programming
  • AST and symbol support

C++ Support in Maguyva: Class and Call Graphs at Scale

Maguyva parses C++ with AST, symbol, and graph support, so AI agents can follow classes, namespaces, virtual overrides, and callers in large C++ codebases.

In C++, names are not unique. send might be a free function, a member of three classes, and an override in a fourth. Namespaces, templates, and out-of-line definitions such as Socket::send in a .cpp file split one type across many files. Text search returns every match; it does not tell an agent which one a call reaches.

Maguyva indexes classes, members, and calls with their owners attached, so an agent can follow the real structure before it edits.

What Maguyva extracts in C++

Maguyva covers the common C++ source and header extensions, including .cpp, .cc, .cxx, .hpp, .hh, and .hxx. Classes, structs, and functions are extracted, and an out-of-line definition such as void Socket::send() is attributed to its owner class and namespace. Virtual members are recorded, and template parameters are part of signatures.

Receiver typing follows parameters, local declarations, fields, range-based for loops, and auto, and it looks through unique_ptr, shared_ptr, and optional, so a call such as conn->send() can resolve to the right class. Base-class clauses feed inheritance, and new expressions count as instantiation.

The same export- and annotation-macro masking as C applies. About 273 standard-library names (std::cout, std::endl, printf, and similar) are filtered from relationships. The graph records calls, includes, inheritance, overrides, instantiation, type references, reads and writes, and throw edges.

Example agent prompts

  • “Which classes override Renderer::draw, and who calls it?” (dependency_search)
  • “Show me OrderBook::match and every caller.” (find_symbol)
  • “Explain how a market-data message reaches the strategy engine.” (get_task_context)

Known limits

  • .h appears in the C, C++, and Objective-C extension lists, so headers in mixed C and C++ trees are shared between those profiles.
  • Object-like macro bodies are not parsed, and calls to filtered standard-library names are not graph edges. Use text_pattern_search for macro and std:: usage.

Next steps

Connect a repository with the quickstart, then check the support matrix on the compatibility page. If parts of the tree are plain C, read the C guide too.

Best fit

  • > Game engines, trading systems, browsers, and other large C++ codebases where one header change rebuilds half the tree.
  • > Class hierarchies with virtual methods, where the method that runs is defined somewhere other than where it is called.
  • > Agent-assisted refactoring that needs callers and overrides before a signature change.

Agent workflows

  • > Find every override of a virtual method before changing the base class.
  • > List callers of a namespaced function or class method, such as `net::Socket::send`, across the codebase.
  • > Trace where a class is constructed with `new` and which members it touches next.

Engine details

  • > Out-of-line definitions such as `void Socket::send()` are attributed to their owner class and namespace, and virtual members are recorded.
  • > Receiver typing follows parameters, locals, fields, range-based `for`, and `auto`, and looks through `unique_ptr`, `shared_ptr`, and `optional`.
  • > Base-class clauses feed inheritance, `new` expressions count as instantiation, and about 273 standard-library names are filtered from relationships.

Useful MCP entry points

  • find_symbol

    Use it for a qualified name such as `OrderBook::match` when you need the definition and callers.

  • dependency_search

    Use it on a base class or virtual method to find overrides and callers before a signature change.

  • get_task_context

    Use it for prompts like “explain how a market-data message reaches the strategy engine.”