For `c-header` and `c++-header` inputs, Clang driver selects the `-emit-pch` frontend action and defaults the output suffix name to `.gch` (except clang-cl, which uses `.pch`) to follow GCC. ``` clang -c a.h # a.h.gch clang -xc++-header -c a.h # a.h.gch ``` In every other place we prefer `.pch` to `.gch`. E.g. `-include a.h` probes `a.h.pch` before `a.h.gch`, and we have `-include-pch` instead of `-include-gch`. (Clang and GCC use different extension names for C++ modules as well.) This change isn't disruptive because: * Most newer build systems specify explicit output filenames and are unaffected * Implicit output name users almost assuredly use something like `-include a.h`, which probes both `a.h.pch` and `a.h.gch`[^1] [^1]: In the future, we shall stop probing `a.h.gch` for `-include a.h` as the compatibility intended behavior actually gets in the way (https://discourse.llvm.org/t/how-to-have-clang-ignore-gch-directories/51835). This patch is a prerequisite.
2.0 KiB
2.0 KiB