From 5890c634ba7cc15cf3ff0319a41b8e535734f8ed Mon Sep 17 00:00:00 2001
From: Ted Kremenek
Clang supports an implementation of precompiled headers known as pre-tokenized headers (PTH). Clang's pre-tokenized headers support most of same interfaces as GCC's pre-compiled headers (as well as others) but are -completely different in their implementation. This first describes the -interface for using PTH and then briefly elaborates on their design and -implementation.
+completely different in their implementation. This first describes the interface +for using PTH and then briefly elaborates on its design and implementation.
Language independence: PTH files work with any language that +
Language independence: PTH files work with any language that Clang's lexer can handle, including C, Objective-C, and (in the early stages) C++. This means development on language features at the parsing level or above (which is basically almost all interesting pieces) does not require PTH to be modified.
Architecture independence: In contrast to GCC's PCH files (and +
Architecture independence: In contrast to GCC's PCH files (and those of several other compilers), Clang's PTH files are architecture independent, requiring only a single PTH file when building an program for multiple architectures.
@@ -174,7 +173,7 @@ cache of header files, a single PTH file can be safely used when compiling for multiple architectures. This can also reduce compile times because only a single PTH file needs to be generated during a build instead of several.Reduced memory pressure: Similar to GCC, +
Reduced memory pressure: Similar to GCC, Clang reads PTH files via the use of memory mapping (i.e., mmap). Clang, however, memory maps PTH files as read-only, meaning that multiple invocations of clang-cc can share the same pages in memory from a @@ -183,7 +182,7 @@ also modifies those pages in memory, incurring the copy-on-write costs. The read-only nature of PTH can greatly reduce memory pressure for builds involving multiple cores, thus improving overall scalability.
Fast generation: PTH files can be generated in a small fraction +
Fast generation: PTH files can be generated in a small fraction of the time needed to generate GCC's PCH files. Since PTH/PCH generation is a serial operation that typically blocks progress during a build, faster generation time leads to improved processor utilization with parallel builds on -- 2.40.0