[clang][deps] Move stripping of diagnostic serialization from `clang-scan-deps` to...
authorJan Svoboda <jan_svoboda@apple.com>
Mon, 14 Jun 2021 10:02:19 +0000 (12:02 +0200)
committerJan Svoboda <jan_svoboda@apple.com>
Mon, 14 Jun 2021 10:23:32 +0000 (12:23 +0200)
commit35fa3e60d1612dcc4f8e233b046423d948ca9a9b
tree9fef08aa16b2c46a03051cd8a4e0011dd17a8ee9
parent8ddbb442b6e87efc9c6599280740c6f4fc40963d
[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
clang/include/clang/Tooling/ArgumentsAdjusters.h
clang/lib/Tooling/ArgumentsAdjusters.cpp
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
clang/test/ClangScanDeps/Inputs/strip_diag_serialize.json
clang/test/ClangScanDeps/strip_diag_serialize.cpp
clang/tools/clang-scan-deps/ClangScanDeps.cpp