[all-commits] [llvm/llvm-project] 4da1c1: [Driver] Change default PCH extension name from .g...

Fangrui Song via All-commits all-commits at lists.llvm.org
Sat Sep 16 00:27:58 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4da1c180b996ca0a7f8d64782d1a875eb162ce9c
      https://github.com/llvm/llvm-project/commit/4da1c180b996ca0a7f8d64782d1a875eb162ce9c
  Author: Fangrui Song <i at maskray.me>
  Date:   2023-09-16 (Sat, 16 Sep 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Driver/Types.def
    M clang/test/Driver/pch-codegen.cpp

  Log Message:
  -----------
  [Driver] Change default PCH extension name from .gch to .pch (#66165)

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.




More information about the All-commits mailing list