View the AST

View ASTs from command line

clang -cc1 -ast-dump your_file.c

Interact with ASTs from web interface

We provide an online AST viewer for you to interact with clang AST more friendly. To view the AST, please follow these steps.

Overview of the Clang AST

Example Code

auto lambda(int n) {
    auto x = getchar();
    auto y = (int *)malloc(8);
    *y = x;
    auto z = *y;
    return x;
}

The corresponding AST and APIs to get properties

The Clang AST looks like this. Use the API in the figure to get the corresponding properties when doing traversals.

Reference