2.3 Clang driver overview
When discussing compilers, we typically refer to a command-line utility that initiates and manages the compilation process. For example, to use the GNU Compiler Collection, one must call gcc
to start the compilation process. Similarly, to compile a C++ program using Clang, one must call clang
as the compiler. The program that controls the compilation process is known as the driver. The driver coordinates different stages of compilation and connects them together. In the book, we will be focusing on LLVM and using Clang as the driver for the compilation process.
It may be confusing for readers that the same word, ”Clang,” is used to refer to both the compiler frontend and the compilation driver. In contrast, with other compilers, where the driver and C++ compiler can be separate executables, ”Clang” is a single executable that functions as both the driver and the compiler frontend. To use Clang as the compiler frontend only, the special...