Using PCH files to reduce compile time
Precompiled Header files can help reduce compilation time when the same header file is used by multiple source files.
When compiling source files, the included header files are also compiled. If a header file is included in more than one source file, it is recompiled when each source file is compiled. Also, header files can introduce many lines of code, but the primary source files that include them can be relatively small. Therefore, it is often desirable to avoid recompiling a set of header files by precompiling them. These are referred to as PCH files.
To generate a PCH file using
armclang, use the
-x option, for example:
armclang --target=aarch64-arm-none-eabi -x c-header test.h -o test.h.pch
To use an existing PCH file, use the
-include option, for example:
armclang --target=aarch64-arm-none-eabi -include test.h test.c -o test
armclangdoes not automatically use PCH files for headers that are included within a source file using
#include. Use the
-includeoption if you want to make use of existing PCH files.
See Precompiled Headers in the Clang Compiler User's
Manual for full details about controlling diagnostics with