Summary
In this chapter, we described the Clang frontend. We explained the distinction between the Clang frontend libraries, the compiler driver, and the actual compiler in the clang -cc1
tool. We also talked about diagnostics and introduced a small libclang
program to dump them. Next, we went touring through all steps of the frontend: lexer, parser, semantic analysis, and code generation by showing how Clang implements these stages. Finally, we finished the chapter with an example of how to write a simple compiler driver that activates all frontend stages. If you are interested in reading more about the AST, a good community document is at http://clang.llvm.org/docs/IntroductionToTheClangAST.html. If you are interested in reading more about the Clang design, you should check out http://clang.llvm.org/docs/InternalsManual.html before diving into the actual source code.
In the next chapter, we will move on to the next step of the compilation pipeline: the LLVM intermediate representation...