[all-commits] [llvm/llvm-project] 35fa3e: [clang][deps] Move stripping of diagnostic seriali...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Mon Jun 14 03:23:51 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 35fa3e60d1612dcc4f8e233b046423d948ca9a9b
      https://github.com/llvm/llvm-project/commit/35fa3e60d1612dcc4f8e233b046423d948ca9a9b
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2021-06-14 (Mon, 14 Jun 2021)

  Changed paths:
    M clang/include/clang/Tooling/ArgumentsAdjusters.h
    M clang/lib/Tooling/ArgumentsAdjusters.cpp
    M clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
    M clang/test/ClangScanDeps/Inputs/strip_diag_serialize.json
    M clang/test/ClangScanDeps/strip_diag_serialize.cpp
    M clang/tools/clang-scan-deps/ClangScanDeps.cpp

  Log Message:
  -----------
  [clang][deps] Move stripping of diagnostic serialization from `clang-scan-deps` to `DependencyScanning` library

To prevent the creation of diagnostics file, `clang-scan-deps` strips the corresponding command-line argument. This behavior is useful even when using the C++ `DependencyScanner` library.

This patch transforms stripping of command-line in `clang-scan-deps` into stripping of `CompilerInvocation` in `DependencyScanning`.

AFAIK, the `clang-cl` driver doesn't even accept `--serialize-diagnostics`, so I've removed the test. (It would fail with an unknown command-line argument otherwise.)

Note: Since we're generating command-lines for modular dependencies from `CompilerInvocation`, the `--serialize-diagnostics` will be dropped. This was already happening in `clang-scan-deps` before this patch, but it will now happen also when using `DependencyScanning` library directly. This is resolved in D104036.

Reviewed By: dexonsmith, arphaman

Differential Revision: https://reviews.llvm.org/D104012


  Commit: d8bab69ead22a10dc4cdb2e36f6ea6fdfe774e2e
      https://github.com/llvm/llvm-project/commit/d8bab69ead22a10dc4cdb2e36f6ea6fdfe774e2e
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2021-06-14 (Mon, 14 Jun 2021)

  Changed paths:
    M clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
    M clang/test/ClangScanDeps/modules-pch.c
    M clang/test/ClangScanDeps/modules.cpp
    M clang/test/ClangScanDeps/regular_cdb.cpp
    M clang/tools/clang-scan-deps/ClangScanDeps.cpp

  Log Message:
  -----------
  [clang][deps] Move invocation adjustments from `clang-scan-deps` to `DependencyScanning` library

The `clang-scan-deps` tool has some logic that parses and modifies the original Clang command-line. The goal is to setup `DependencyOutputOptions` by injecting `-M -MT <target>` and prevent the creation of output files.

This patch moves the logic into the `DependencyScanning` library, and uses the parsed `CompilerInvocation` instead of the raw command-line. The code simpler and can be used from the C++ API as well.

The `-o /dev/null` arguments are not necessary, since the `DependencyScanning` library only runs a preprocessing action, so there's no way it'll produce an actual object file.

Related: The `-M` argument implies `-w`, which would appear on the command-line of modular dependencies even though it was not on the original TU command line (see D104036).

Some related tests were updated.

Reviewed By: arphaman

Differential Revision: https://reviews.llvm.org/D104030


  Commit: cf7d9704688db746b26d739a6e154ad54b6b676e
      https://github.com/llvm/llvm-project/commit/cf7d9704688db746b26d739a6e154ad54b6b676e
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2021-06-14 (Mon, 14 Jun 2021)

  Changed paths:
    M clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
    M clang/tools/clang-scan-deps/ClangScanDeps.cpp

  Log Message:
  -----------
  [clang][deps] Move injection of `-Wno-error` from `clang-scan-deps` to `DependencyScanning` library

This moves another piece of logic specific to `clang-scan-deps` into the `DependencyScanning` library. This makes it easier to check how the original command-line looked like in the library and will enable the library to stop inventing `-Wno-error` for modular dependencies (see D104036).

Reviewed By: arphaman

Differential Revision: https://reviews.llvm.org/D104031


  Commit: 6c6dcfc4ce750bb7dc15d0a4ad631c66beed70d4
      https://github.com/llvm/llvm-project/commit/6c6dcfc4ce750bb7dc15d0a4ad631c66beed70d4
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2021-06-14 (Mon, 14 Jun 2021)

  Changed paths:
    M clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
    M clang/tools/clang-scan-deps/ClangScanDeps.cpp

  Log Message:
  -----------
  [clang][deps] Move enabling system header deps from `clang-scan-deps` to `DependencyScanning` library

This patch moves enabling system header deps from `clang-scan-deps` into the `DependencyScanning` library. This will make it easier to preserve semantics of the original TU command-line for modular dependencies (see D104036).

Reviewed By: arphaman

Differential Revision: https://reviews.llvm.org/D104033


Compare: https://github.com/llvm/llvm-project/compare/8ddbb442b6e8...6c6dcfc4ce75


More information about the All-commits mailing list