[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
Tue Dec 6 16:06:19 PST 2022


jansvoboda11 added inline comments.


================
Comment at: clang/lib/Frontend/HeaderIncludeGen.cpp:161
+  case HIF_Textual: {
+    assert(!DepOpts.HeaderIncludeFiltering &&
+           "header filtering is currently always disabled when output format is"
----------------
ahatanak wrote:
> jansvoboda11 wrote:
> > I don't think asserting on invalid user input is a good strategy. Let's emit a diagnostic and exit gracefully instead.
> The combination of `(textual,filtering)` is rejected by the driver, so the assertion should always succeed if the user invoked the driver and set the environment variables. Do we need a diagnostic for the case where `-header-include-format` and `-header-include-filtering` are passed on the CC1 command line by the user?
Ah, you're right about the driver. Yes. I think we should emit a diagnostic when this is passed to cc1 on the command line. Good place for this might be `ParseDependencyOutputArgs` in `CompilerInvocation.cpp`, after the marshalling layer populates the `DependencyOutputOptions` fields.


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