IRILL - Research and Innovation on Free Software

The Clang AST - a tutorial


"The Clang AST - a tutorial"
by Manuel Klimek - Google,
on 2013-04-30 00:00:00
Download Webm format
Download MP4 format

For engineers starting to contribute to Clang or writing tools based on Clang, the AST is often the first big stumbling stone. While it merely mirrors the complexity of the languages it represents, learning how to navigate between the nodes can be a daunting task. In this tutorial I will present the structure of Clang's AST, how the nodes match to C++ language constructs and how to make good use of the documentation and tools available to navigate the maze to find what you need. We will take an in-depth look at various common connections, like templates and their definitions, source locations and types, dependent types, typedefs, and more. Using simple code samples I'll walk through the basic handling of AST nodes, and dive into more advanced topics focusing on the C++ specific parts of the AST.