Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Clang Compiler Frontend

You're reading from   Clang Compiler Frontend Get to grips with the internals of a C/C++ compiler frontend and create your own tools

Arrow left icon
Product type Paperback
Published in Mar 2024
Publisher Packt
ISBN-13 9781837630981
Length 326 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Ivan Murashko Ivan Murashko
Author Profile Icon Ivan Murashko
Ivan Murashko
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Part I: Clang Setup and Architecture FREE CHAPTER
2. Chapter 1: Environment Setup 3. Chapter 2: Clang Architecture 4. Chapter 3: Clang AST 5. Chapter 4: Basic Libraries and Tools 6. Part II: Clang Tools
7. Chapter 5: Clang-Tidy Linter Framework 8. Chapter 6: Advanced Code Analysis 9. Chapter 7: Refactoring Tools 10. Chapter 8: IDE Support and Clangd 11. Part III: Appendix
12. Bibliography
13. Index 14. Other Books You Might Enjoy Appendix 1: Compilation Database 1. Appendix 2: Build Speed Optimization

Preface

Low Level Virtual Machine (LLVM), is a collection of modular and reusable compiler and toolchain technologies used to develop compilers and compiler tools, such as linters and refactoring tools. LLVM is written in C++ and can be considered a good example of a well-structured project that uses interesting techniques aimed at making it reusable and efficient. The project can also be considered an excellent example of compiler architecture; diving into it will give you a sense of how compilers are organized and how they function. This should help to understand usage patterns and apply them accordingly.

One of the key components of LLVM is the C/C++ compiler known as Clang. This compiler is widely used across various companies and has been designated as the default compiler for certain development environments, notably for macOS development. Clang will be the primary focus of our investigation in this book, with particular attention to its frontend—the part that is closest to the C/C++ programming language. Specifically, the book will include examples demonstrating how the C++ standard is implemented within the compiler.

A pivotal aspect of LLVM’s design is its modularity, which facilitates the creation of custom tools that exploit the compiler’s comprehensive capabilities. A notable example covered in the book is the Clang-Tidy linter framework, designed to identify undesirable code patterns and recommend corrections. Although it includes several hundred checks, you may not find one specific to your project’s needs. However, the book will provide you with the foundation necessary to develop such a check from the beginning.

LLVM is an actively evolving project with two major releases each year. At the time the book was written, the latest stable release was version 17. Meanwhile, a release candidate for version 18 was introduced in January 2024, with its official release anticipated to coincide with the publication of the book. The book’s content has been verified against the latest compiler version, 18, ensuring it provides insights based on the most current compiler implementation available.

lock icon The rest of the chapter is locked
Next Section arrow right
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image