[clang][deps] Fix handling of -MT in module command-line
authorBen Langmuir <blangmuir@apple.com>
Tue, 12 Jul 2022 23:55:11 +0000 (16:55 -0700)
committerBen Langmuir <blangmuir@apple.com>
Wed, 13 Jul 2022 20:36:15 +0000 (13:36 -0700)
commit3ce78cbd2392d7c98f97d1d424cd7ff582fc28f8
tree87623ae2a72558525fb43c9f21a166d43b8473db
parent94e0f8e001002b828c42048f383806295e7abbb2
[clang][deps] Fix handling of -MT in module command-line

Follow-up to 6626f6fec3d3, this fixes the handling of -MT
* If no targets are provided, we need to invent one since cc1 expects
  the driver to have handled it. The default is to use -o, quoting as
  necessary for a make target.
* Fix the splitting for empty string, which was incorrectly treated as
  {""} instead of {}.
* Add a way to test this behaviour in clang-scan-deps.

Differential Revision: https://reviews.llvm.org/D129607
clang/include/clang/Basic/MakeSupport.h [new file with mode: 0644]
clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
clang/lib/Basic/CMakeLists.txt
clang/lib/Basic/MakeSupport.cpp [new file with mode: 0644]
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
clang/test/ClangScanDeps/generate-modules-path-args.c
clang/tools/clang-scan-deps/ClangScanDeps.cpp