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.