diff --git a/clang/docs/PCHInternals.html b/clang/docs/PCHInternals.html index b34b6a29ccbc..e21ec5e90df3 100644 --- a/clang/docs/PCHInternals.html +++ b/clang/docs/PCHInternals.html @@ -26,7 +26,7 @@
Table of Contents
The low-level Clang compiler, clang-cc, supports two command -line options for generating and using PCH files.
+
The Clang compiler frontend, clang -cc1, supports two command line +options for generating and using PCH files.
-
To generate PCH files using clang-cc, use the option +
To generate PCH files using clang -cc1, use the option -emit-pch: -
$ clang-cc test.h -emit-pch -o test.h.pch+
$ clang -cc1 test.h -emit-pch -o test.h.pch
This option is transparently used by clang when generating PCH files. The resulting PCH file contains the serialized form of the @@ -61,7 +61,7 @@ semantic analysis. The PCH file can then be used as a prefix header with the -include-pch option:
- $ clang-cc -include-pch test.h.pch test.c -o test.s + $ clang -cc1 -include-pch test.h.pch test.c -o test.s
The low-level Clang compiler tool, clang-cc, supports three command -line options for generating and using PTH files.
+
The Clang compiler frontend, clang -cc1, supports three command line +options for generating and using PTH files.
-
To generate PTH files using clang-cc, use the option +
To generate PTH files using clang -cc1, use the option -emit-pth: -
$ clang-cc test.h -emit-pth -o test.h.pth+
$ clang -cc1 test.h -emit-pth -o test.h.pth
This option is transparently used by clang when generating PTH files. Similarly, PTH files can be used as prefix headers using the -include-pth option:
- $ clang-cc -include-pth test.h.pth test.c -o test.s + $ clang -cc1 -include-pth test.h.pth test.c -o test.s
Alternatively, Clang's PTH files can be used as a raw "token-cache" (or "content" cache) of the source included by the original header file. This means that the contents of the PTH file are searched as substitutes -for any source files that are used by clang-cc to process a +for any source files that are used by clang -cc1 to process a source file. This is done by specifying the -token-cache option:
$ cat test.h #include <stdio.h> - $ clang-cc -emit-pth test.h -o test.h.pth + $ clang -cc1 -emit-pth test.h -o test.h.pth $ cat test.c #include "test.h" - $ clang-cc test.c -o test -token-cache test.h.pth + $ clang -cc1 test.c -o test -token-cache test.h.pth
In this example the contents of stdio.h (and the files it includes) @@ -117,7 +117,7 @@ PTH file needs to be generated during a build instead of several.
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 +invocations of clang -cc1 can share the same pages in memory from a memory-mapped PTH file. In comparison, GCC also memory maps its PCH files but 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 @@ -160,7 +160,7 @@ optimizations to speed up the processing of header files:
stat caching: PTH files cache information obtained via -calls to stat that clang-cc uses to resolve which files are +calls to stat that clang -cc1 uses to resolve which files are included by #include directives. This greatly reduces the overhead involved in context-switching to the kernel to resolve included files.
t1.c
and t2.c
:
-$ clang-cc -emit-pch t1.c -o t1.ast -$ clang-cc -emit-pch t2.c -o t2.ast +$ clang -emit-ast t1.c -o t1.ast +$ clang -emit-ast t2.c -o t2.ast