Allow users to run a dependency scan with a cc1 command line in addition to a driver command line. DependencyScanningAction was already being run with a cc1 command line, but DependencyScanningWorker::computeDependencies assumed that it was always provided a driver command line. Now DependencyScanningWorker::computeDependencies can handle cc1 command lines too.
Details
Diff Detail
Event Timeline
This looks pretty good!
I'm not sure unit testing is the best choice here, since we're not checking for low-level properties or hard-to-observe behavior. In general LIT tests are easier to write/maintain/understand and don't require recompiling, so I'd suggest to transform the existing unit test into something similar to tests in clang/test/ClangScanDeps/.
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp | ||
---|---|---|
414 | ||
507 |
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp | ||
---|---|---|
482 | Is there a good way to validate cc1 command lines? |
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp | ||
---|---|---|
482 | Not really, you just have to parse it. Was there a particular reason you wanted to validate here? |
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp | ||
---|---|---|
482 | I think that happens in ToolInvocation::run() that's called by createAndRunToolInvocation. Are you seeing cases where we don't emit a diagnostic for an invalid -cc1 command line? | |
clang/test/ClangScanDeps/Inputs/modules_cc1_cdb.json | ||
1 ↗ | (On Diff #545910) | I assume this was cargo-culted from clang/test/ClangScanDeps/Inputs/modules_cdb.json. I don't think we need multiple entries here and lots of the flags are unnecessary for just testing out -cc1 command lines work. I suggest having just one minimal -cc1 command line here. |
clang/test/ClangScanDeps/modules-cc1.cpp | ||
11 | Recently, we've been using split-file to set up the file system for our tests. It's much easier to see what's going on in a glance. Can you transform the test into that format? You can take inspiration from clang/test/ClangScanDeps/modules-transitive.c for example. | |
19 | Yeah, this is already covered by the other test, I suggest dropping this comment and the -j flag in the clang-scan-deps invocation below. |
clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp | ||
---|---|---|
482 | @jansvoboda11 You're right, ToolInvocation::run() fails if there are any issues when the function creates the compiler invocation - I missed that. I've not seen any cases where diagnostics aren't outputted. | |
482 | @Bigcheese No, I just wanted to make sure some sort of validation was happening and missed the work being done in ToolInvocation::run(). | |
clang/test/ClangScanDeps/Inputs/modules_cc1_cdb.json | ||
1 ↗ | (On Diff #545910) | That is an accurate assumption. Are you good with the following command line clang -cc1 DIR/modules_cdb_input.cpp -IInputs -fimplicit-module-maps -o modules_cdb_input.o? |