Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Clang Compiler Frontend
  • Table Of Contents Toc
Clang Compiler Frontend

Clang Compiler Frontend

By : Ivan Murashko
5 (1)
close
close
Clang Compiler Frontend

Clang Compiler Frontend

5 (1)
By: Ivan Murashko

Overview of this book

Discover the power of Clang, a versatile compiler known for its compilation speed and insightful error and warning messages. This book will get you acquainted with the capabilities of Clang, helping you harness its features for performance improvements and modularity by creating custom compiler tools. While focused on Clang compiler frontend, this book also covers other parts of LLVM, essential to understanding Clang's functionality, to keep up with the constantly evolving LLVM project. Starting with LLVM fundamentals, from installation procedures to development tools, this book walks you through Clang's internal architecture and its integral role within LLVM. As you progress, you’ll also tackle optimizing compilation performance through features such as C++ modules and header maps. The later chapters cover tools developed using the Clang/LLVM, including clang-tidy for linting, refactoring tools, and IDE support, and feature many examples to illustrate the material. By the end of this book, you’ll have a solid understanding of Clang, different Clang Tools, and how to use them to their fullest potential.
Table of Contents (17 chapters)
close
close
Lock Free Chapter
1
Part I: Clang Setup and Architecture
6
Part II: Clang Tools
11
Part III: Appendix
12
Bibliography

4.3 LLVM basic libraries

We are going to start with RTTI replacement in the LLVM code and discuss how it’s implemented. We will then continue with basic containers and smart pointers. We will conclude with some important classes used to represent token locations and how diagnostics are realized in Clang. Later, in Section 4.6, Clang plugin project, we will use some of these classes in our test project.

4.3.1 RTTI replacement and cast operators

As mentioned earlier, LLVM avoids using RTTI due to performance concerns. LLVM has introduced several helper functions that replace RTTI counterparts, allowing for the casting of an object from one type to another. The fundamental ones are as follows:

  • llvm::isa<> is akin to Java’s javainstanceof operator. It returns true or false depending on whether the reference to the tested object belongs to the tested class or not.

  • llvm::cast<>: Use this cast operator when you’re certain that the object is of the specified...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Clang Compiler Frontend
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon