[all-commits] [llvm/llvm-project] d816d9: [clang][ScanDeps] Fix issue with multiple commands...

Michael Spencer via All-commits all-commits at lists.llvm.org
Thu Oct 31 14:22:18 PDT 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d816d9bdc585bbf77a7a1c47a7199fd9e0c34402
      https://github.com/llvm/llvm-project/commit/d816d9bdc585bbf77a7a1c47a7199fd9e0c34402
  Author: Michael Spencer <bigcheesegs at gmail.com>
  Date:   2019-10-31 (Thu, 31 Oct 2019)

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

  Log Message:
  -----------
  [clang][ScanDeps] Fix issue with multiple commands with the same input.

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.

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




More information about the All-commits mailing list