[PATCH] D63579: [clang-scan-deps] print the dependencies to stdout and remove the need to use -MD options in the CDB
Alexandre Ganea via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 20 13:51:26 PDT 2019
aganea added inline comments.
================
Comment at: clang/tools/clang-scan-deps/ClangScanDeps.cpp:32
+class DependencyCollectorFactory {
+public:
----------------
arphaman wrote:
> aganea wrote:
> > Do you envision future uses for this factory?
> Most likely, yes.
>
> I don't want to lock-in into creating the dependency printer in the `PreprocessorOnlyTool`, as the eventual goal is to have it in a library, and allow clients to consume modular dependencies not only using `clang-scan-deps` tool itself, but using the C++ library directly (potentially through a libclang C interface as well). The printer should be in `clang-scan-deps` tool itself though, so it wouldn't be ideal to reference it from `PreprocessorOnlyTool` now.
My initial question was, what are the future planned factories? (and thus the other `DependencyCollector` implementations?)
Do you think we could have the printer in the library as well?
On a related note - we're already testing `clang-scan-deps` compiled as a DLL. Our use-case right now is to call it from each of [[ https://github.com/fastbuild/fastbuild | Fastbuild ]]'s worker threads. We are using `main()` below almost as-is (except for the multithreading part which Fastbuild already does). The CDB JSON is passed by value from the Fastbuild thread, so it doesn't go through a file. I'd like to get back dependencies-as-a-string instead of `llvm::outs()`. The bottleneck currently is, as you can imagine, reading / writing files (seen in ETW traces), this patch should improve things a bit. I can send a sample of how we're using it after you commit.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D63579/new/
https://reviews.llvm.org/D63579
More information about the cfe-commits
mailing list