Skip to content
cd /languages
  • Systems core
  • Programming
  • AST and symbol support

C Support in Maguyva: Call Graphs for Systems and Embedded Code

Maguyva parses C with AST, symbol, and graph support, so AI agents can trace functions, structs, includes, and callers in systems, firmware, and library code.

Why C needs a call graph, not grep

C has no classes or modules to organize it. Structure lives in function calls, headers, and structs, and the same name can appear in comments, macros, and string literals. Export and annotation macros wrap declarations, which trips up tools that only parse plain C. For an agent, the safe first step is the call graph.

Maguyva builds that graph so an agent can see what a function reaches and what reaches it before it proposes a change.

What Maguyva extracts in C

Maguyva covers .c and .h. Function definitions are extracted as symbols, and structs and unions are selectable as type definitions in structural search. #include directives become import relationships.

Export and visibility macros (patterns such as FOO_API, DLLEXPORT, or LIBEXPORT) and thread-safety annotation macros (such as GUARDED_BY and REQUIRES) are masked before parsing, so declarations wrapped in them still parse as declarations. Function-like macro bodies are parsed; object-like macro bodies are not.

The graph records calls, includes, compound-literal instantiation, type references, reads and writes, and control flow. About 124 standard C library calls (printf, malloc, free, memcpy, strlen, and similar) are filtered from relationships so project code stands out.

Example agent prompts

  • “Who calls uart_write, directly or through other functions?” (dependency_search incoming)
  • “Which files include config.h, and which of its structs do they use?” (dependency_search, then find_symbol)
  • “Explain how a packet moves from the receive interrupt to the protocol parser.” (get_task_context)

Known limits

  • C has no classes or exceptions, so inheritance, interface implementation, override, throw, and catch relationships are marked not applicable.
  • .h appears in the C, C++, and Objective-C extension lists, so mixed-language headers are shared between those profiles.
  • Calls to filtered standard library functions are not graph edges. Use text_pattern_search when you need every malloc or memcpy.

Next steps

Connect a repository with the quickstart, then check the support matrix on the compatibility page. For C++ code in the same tree, read the C++ guide.

Best fit

  • > Firmware, embedded, and operating-system teams where a small change to a shared function can reach hardware paths.
  • > Long-lived C libraries with public headers, export macros, and many internal translation units.
  • > Agent-assisted reviews where the question is "who calls this, and through which headers?"

Agent workflows

  • > Find every caller of a function before changing its signature or error handling.
  • > Map which files include a header and which structs they use.
  • > Trace a request from an interrupt handler or entry point through the functions it reaches.

Engine details

  • > C support covers `.c` and `.h`. Function definitions are symbols, structs and unions are type definitions, and `#include` becomes an import relationship.
  • > Export, visibility, and thread-safety annotation macros are masked before parsing, so wrapped declarations still parse. Function-like macro bodies are parsed; object-like ones are not.
  • > About 124 standard library calls such as `printf`, `malloc`, and `memcpy` are filtered. Inheritance, override, and exception relationships are marked not applicable.

Useful MCP entry points

  • find_symbol

    Use it for a function or struct name when you need the definition and every reference.

  • dependency_search

    Use incoming traversal on a shared function before changing its signature or error handling.

  • get_task_context

    Use it for prompts like “explain how a packet moves from the receive interrupt to the protocol parser.”