2
Clang Architecture
In this chapter, we will examine the internal architecture of Clang and its relationship with other LLVM components. We will begin with an overview of the overall compiler architecture, with a specific focus on the clang driver. As the backbone of the compiler, the driver runs all compilation phases and controls their execution. Finally, we will concentrate on the frontend portion of the Clang compiler, which includes lexical and semantic analysis, and produces an Abstract Syntax Tree (AST ) as its primary output. The AST forms the foundation for most Clang tools, and we will examine it more closely in the next chapters.
The following topics will be covered in this chapter:
Compiler overview
Clang driver overview, including an explanation of the compilation phases and their execution
Clang frontend overview covering the preprocessing step, parsing, and semantic analysis