3
Clang AST
The parsing stage of any compiler generates a parse tree, and the Abstract Syntax Tree (AST) is a fundamental algorithmic structure that is generated during the parsing of a given input program. The AST serves as the framework for the Clang frontend and is the primary tool for various Clang utilities, including linters. Clang offers sophisticated tools for searching (or matching) various AST nodes. These tools are implemented using a Domain-Specific Language (DSL). It’s crucial to understand its implementation to use it effectively.
We will start with the basic data structures and the class hierarchy that Clang uses to construct the AST. Additionally, we will explore the methods used for AST traversal and highlight some helper classes ...
Get Clang Compiler Frontend now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.