10.3 Clang modules
Modules, or Precompiled Modules (PCMs), can be considered the next step in the evolution of precompiled headers. They also represent a parsed AST in binary form but form a DAG (tree), meaning one module can include more than one other module.
This is a major improvement compared to precompiled headers, where only one precompiled header can be introduced for each compilation unit.
The C++20 standard [21] introduced two concepts related to modules. The first one is ordinary modules, described in section 10 of [21]. The other one is the so-called header unit , mostly described in section 15.5. Header units can be considered an intermediate step between ordinary headers and modules and allow the use of the import
directive to import ordinary headers.
We will focus on Clang modules, which can be considered an implementation of header units from the C++ standard. There are two different options to use Clang modules. The first one is called explicit modules. The second is...