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 ...

Get Getting Started with LLVM Core Libraries 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.