[PATCH] D137996: Add support for a backdoor driver option that enables emitting header usage information in JSON to a file

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 5 13:58:41 PST 2022


jansvoboda11 added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:5660
+        "-header-include-filtering=" +
+        std::string(D.CCPrintHeadersFiltering ? "on" : "off")));
   }
----------------
Let's change "on" to something that won't interfere with potential future filters. How about "no-transitive-system"? (or "only-direct-system" if that better fits the semantics)

Same for the command-line counterpart.


================
Comment at: clang/lib/Frontend/HeaderIncludeGen.cpp:161
+  case HIF_Textual: {
+    assert(!DepOpts.HeaderIncludeFiltering &&
+           "header filtering is currently always disabled when output format is"
----------------
I don't think asserting on invalid user input is a good strategy. Let's emit a diagnostic and exit gracefully instead.


================
Comment at: clang/tools/driver/driver.cpp:278
+        (TheDriver.CCPrintHeadersFormat == HIF_JSON && !Filtering)) {
+      llvm::errs()
+          << "error: unsupported configuration: "
----------------
This should probably be a proper diagnostic.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137996



More information about the cfe-commits mailing list