[clang][deps] Support object files
authorJan Svoboda <jan_svoboda@apple.com>
Wed, 2 Jun 2021 12:49:14 +0000 (14:49 +0200)
committerJan Svoboda <jan_svoboda@apple.com>
Fri, 4 Jun 2021 12:58:42 +0000 (14:58 +0200)
commitde07b1e84d8de948304766df602fee2b845e9532
treeeb98f0be51c65060efdbf5e9b0d5d898a27401ef
parent20bd2142d46536f4ffd61f28a029d6bda68f1a7f
[clang][deps] Support object files

When a project uses PCH with explicit modules, the build will look like this:

1. scan PCH dependencies
2. explicitly build PCH
3. scan TU dependencies
4. explicitly build TU

Step 2 produces an object file for the PCH, which the dependency scanner needs to read in step 3. This patch adds support for this.

The `clang-scan-deps` invocation in the attached test would fail without this change.

Depends on D103516.

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D103519
clang/lib/Tooling/DependencyScanning/CMakeLists.txt
clang/lib/Tooling/DependencyScanning/DependencyScanningService.cpp
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
clang/test/ClangScanDeps/Inputs/modules-pch/cdb_tu.json [new file with mode: 0644]
clang/test/ClangScanDeps/Inputs/modules-pch/mod_tu.h [new file with mode: 0644]
clang/test/ClangScanDeps/Inputs/modules-pch/module.modulemap [new file with mode: 0644]
clang/test/ClangScanDeps/Inputs/modules-pch/pch.h [new file with mode: 0644]
clang/test/ClangScanDeps/Inputs/modules-pch/tu.c [new file with mode: 0644]
clang/test/ClangScanDeps/modules-pch.c [new file with mode: 0644]