[PATCH] D126796: [clang][driver] adds `-print-diagnostics`

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 2 11:50:19 PDT 2022


cjdb updated this revision to Diff 433823.
cjdb added a comment.
Herald added subscribers: sstefan1, mgrang, aheejin.
Herald added a reviewer: jdoerfert.

- renames flag to `-print-diagnostic-options`
- adds test
- adds logic to get as many options to be visible as possible

I'm very unhappy with the last point: `getDiagnosticFlags` doesn't seem to return *all* diagnostic flags
(`-W` is missing with R0 of this patch), and even now, both `-Wgnu-statement-expression-from-macro-expansion`
and `-Wqualified-void-return-type` are missing from the list despite being in the webpage.

Doing `clang -print-diagnostic-options | wc` reveals that there are also some options that I'm seeing as warnings,
while the docs consider these remarks:

1. `-Wmodule-build`
2. `-Wmodule-import`
3. `-Wmodule-lock`
4. `-Wpass`
5. `-Wpass-analysis`
6. `-Wpass-missed`
7. `-Wremark-backend-plugin`
8. `-Wround-trip-cc1-args`
9. `-Wsanitize-address`
10. `-Wsearch-path-usage`

If Clang promoting these to warning flags is fine, that's okay. Regardless, it reveals a flaw in testing because
these ten options aren't being flagged as missing when they probably should be. Is FileCheck capable of checking
that all lines correspond to a file, or should I move to using `diff`?


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

https://reviews.llvm.org/D126796

Files:
  clang/include/clang/Driver/Options.td
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/print-diagnostic-options.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126796.433823.patch
Type: text/x-patch
Size: 34550 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220602/f8c8fdce/attachment-0001.bin>


More information about the cfe-commits mailing list