[PATCH] D60233: [clang-scan-deps] initial outline of the tool that runs preprocessor to find dependencies over a JSON compilation database

Alexandre Ganea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 7 07:31:42 PDT 2019


aganea added inline comments.


================
Comment at: clang/test/ClangScanDeps/Inputs/regular_cdb.json:4
+  "directory": "DIR",
+  "command": "clang -c DIR/regular_cdb.cpp -IInputs -MD -MF DIR/regular_cdb.d",
+  "file": "DIR/regular_cdb.cpp"
----------------
Is `-MD -MF` required for clang-scan-deps to work? Can't we append those arguments automatically, so that only include paths are needed in the CDB?

Would it possible for the tool to produce a collated file? A real-world usage would otherwise produce tens of thousands of files. Which then would be opened/parsed by the calling application.


================
Comment at: clang/test/ClangScanDeps/regular_cdb.cpp:8
+// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/regular_cdb.json > %t.cdb
+// RUN: clang-scan-deps -compilation-database %t.cdb -j 1
+// RUN: cat %t.dir/regular_cdb.d | FileCheck %s
----------------
Add a second test to excercice multi-threading? (by providing a few more files in the CDB)


================
Comment at: clang/tools/clang-scan-deps/ClangScanDeps.cpp:140
+int main(int argc, const char **argv) {
+  llvm::cl::ResetAllOptionOccurrences();
+  llvm::cl::HideUnrelatedOptions(DependencyScannerCategory);
----------------
`InitLLVM X(argc, argv);` is missing here to print callstacks in case of a crash, like the other tools.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60233/new/

https://reviews.llvm.org/D60233





More information about the cfe-commits mailing list