[PATCH] D69643: [clang][ScanDeps] Fix issue with multiple commands with the same input.

Michael Spencer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 30 14:21:44 PDT 2019


Bigcheese created this revision.
Bigcheese added reviewers: arphaman, klimek.
Bigcheese added a project: clang.
Herald added a subscriber: dexonsmith.

Previously, given a CompilationDatabase with two commands for the same
source file we would report that file twice with the union of the
dependencies for each command both times.

This was due to the way `ClangTool` runs actions given an input source
file (see the comment in `DependencyScanningTool.cpp`). This commit adds
a `SingleCommandCompilationDatabase` that is created with each
`CompileCommand` in the original CDB, which is then used for each
`ClangTool` invocation. This gives us a single run of
`DependencyScanningAction` per `CompileCommand`.

I looked at using `AllTUsToolExecutor` which is a parallel tool
executor, but I'm not sure it's suitable for `clang-scan-deps` as it
does a lot more sharing of state than `AllTUsToolExecutor` expects.

I've added Manuel as a reviewer to see if there's an obviously better way to do this with libTooling.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69643

Files:
  clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
  clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
  clang/test/ClangScanDeps/Inputs/regular_cdb.json
  clang/test/ClangScanDeps/error.cpp
  clang/test/ClangScanDeps/regular_cdb.cpp
  clang/tools/clang-scan-deps/ClangScanDeps.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69643.227178.patch
Type: text/x-patch
Size: 8692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191030/f7b0e18a/attachment-0001.bin>


More information about the cfe-commits mailing list