[all-commits] [llvm/llvm-project] f726da: [Driver] -include: deprecate probing .gch (#67084)

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Sep 25 09:56:43 PDT 2023


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

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticDriverKinds.td
    M clang/lib/Driver/ToolChains/Clang.cpp
    M clang/test/ClangScanDeps/Inputs/modules-pch-common-submodule/cdb_pch.json
    M clang/test/ClangScanDeps/Inputs/modules-pch-common-via-submodule/cdb_pch.json
    M clang/test/ClangScanDeps/Inputs/modules-pch/cdb_pch.json
    M clang/test/ClangScanDeps/modules-pch-common-submodule.c
    M clang/test/ClangScanDeps/modules-pch-common-via-submodule.c
    M clang/test/ClangScanDeps/modules-pch.c
    M clang/test/Index/cindex-from-source.m
    M clang/test/PCH/pch-dir.c
    M clang/test/SemaCXX/warn-unused-local-typedef-serialize.cpp

  Log Message:
  -----------
  [Driver] -include: deprecate probing .gch (#67084)

`-include a.h` probes `a.h.pch` and `a.h.gch`, if not found, falls back to
`a.h`. `.pch` is the preferred extension name. Probing .gch is supposed to
provide compatibility with build systems that do
```
clang -x c-header a.h -o out/a.h.gch
clang -include out/a.h -c a.c  # out/a.h.gch is present while out/a.h is absent
```
(not sure what projects actually do this with Clang)

But it can often get in the way [^0][^1][^2] when GCC and Clang are mixed as the file
format is incompatible with GCC's. Let's deprecate .gch probing.
Some tests using `-include` are switched to `.pch`.
`test/PCH/pch-dir.c` shows the -Wdeprecated warning.

[^0]: https://discourse.llvm.org/t/how-to-have-clang-ignore-gch-directories/51835
[^1]: https://bugreports.qt.io/browse/QTCREATORBUG-22427
[^2]: https://gitlab.kitware.com/cmake/cmake/-/issues/22081




More information about the All-commits mailing list