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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 8 07:28:47 PDT 2022


aaron.ballman added a comment.

Thanks for this! Just some fairly minor nits from me. FWIW, the changes should also come with a release note so users know about the new command line option.



================
Comment at: clang/include/clang/Driver/Options.td:829
 def Xoffload_linker : JoinedAndSeparate<["-"], "Xoffload-linker">,
-  HelpText<"Pass <arg> to the offload linkers or the ones idenfied by -<triple>">, 
+  HelpText<"Pass <arg> to the offload linkers or the ones idenfied by -<triple>">,
   MetaVarName<"<triple> <arg>">, Group<Link_Group>;
----------------
Unintended whitespace change?


================
Comment at: clang/lib/Basic/DiagnosticIDs.cpp:656
 std::vector<std::string> DiagnosticIDs::getDiagnosticFlags() {
-  std::vector<std::string> Res;
+  std::vector<std::string> Res{"-W", "-Wno-"};
   for (size_t I = 1; DiagGroupNames[I] != '\0';) {
----------------
I presume this change doesn't have any negative effects in `Driver::HandleAutocompletions()`? (That's currently the only consumer of this API.)


================
Comment at: clang/lib/Driver/Driver.cpp:2010
+  if (C.getArgs().hasArg(options::OPT_print_diagnostic_options)) {
+    std::vector<std::string> Flags = DiagnosticIDs::getDiagnosticFlags();
+    for (std::size_t I = 0; I != Flags.size(); I += 2)
----------------
Declare the type as a const reference?

(Btw, when uploading patches, you should give them plenty of patch context -- that's what allows reviewers to suggest changes directly in Phab, but it also gives more information to reviewers so they don't have to leave the review to go to a code editor. FWIW, I usually use `-U999` to add context.)


================
Comment at: clang/test/Driver/print-diagnostic-options.c:1
+// Test that -print-diagnostic-options prints all warning groups
+
----------------
"All" warning groups? ;-) Might want to update the comment somewhat.


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

https://reviews.llvm.org/D126796



More information about the cfe-commits mailing list