[PATCH] D123545: [LLVM-ML] Add standard LLVM debug flags

Eric Astor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 13:51:47 PDT 2022


epastor created this revision.
epastor added reviewers: thakis, rnk.
Herald added a project: All.
epastor requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Adds support for -debug and -debug-only= flags.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123545

Files:
  llvm/tools/llvm-ml/Opts.td
  llvm/tools/llvm-ml/llvm-ml.cpp


Index: llvm/tools/llvm-ml/llvm-ml.cpp
===================================================================
--- llvm/tools/llvm-ml/llvm-ml.cpp
+++ llvm/tools/llvm-ml/llvm-ml.cpp
@@ -243,6 +243,13 @@
         << "' option\n";
   }
 
+  if (InputArgs.hasArg(OPT_debug)) {
+    DebugFlag = true;
+  }
+  for (auto *Arg : InputArgs.filtered(OPT_debug_only)) {
+    setCurrentDebugTypes(Arg->getValues().data(), Arg->getNumValues());
+  }
+
   if (InputArgs.hasArg(OPT_help)) {
     std::string Usage = llvm::formatv("{0} [ /options ] file", ProgName).str();
     T.printHelp(outs(), Usage.c_str(), "LLVM MASM Assembler",
Index: llvm/tools/llvm-ml/Opts.td
===================================================================
--- llvm/tools/llvm-ml/Opts.td
+++ llvm/tools/llvm-ml/Opts.td
@@ -7,6 +7,7 @@
 class LLVMJoined<string name> : Joined<["--", "-"], name>;
 class LLVMJoinedOrSeparate<string name> : JoinedOrSeparate<["--", "-"], name>;
 class LLVMSeparate<string name> : Separate<["--", "-"], name>;
+class LLVMCommaJoined<string name> : CommaJoined<["--", "-"], name>;
 
 def ml_Group : OptionGroup<"<ml options>">,
                HelpText<"ML.EXE COMPATIBILITY OPTIONS">;
@@ -31,6 +32,11 @@
               HelpText<"Target platform (x86 or x86-64)">;
 def as_lex : LLVMFlag<"as-lex">,
              HelpText<"Lex tokens from a .asm file without assembling">;
+def debug : LLVMFlag<"debug">, Flags<[HelpHidden]>,
+            HelpText<"Enable debug output">;
+def debug_only : LLVMCommaJoined<"debug-only=">, Flags<[HelpHidden]>,
+                 HelpText<"Enable a specific type of debug output (comma "
+                          "separated list of types)">;
 def fatal_warnings : LLVMFlag<"fatal-warnings">,
                      HelpText<"Treat warnings as errors">;
 def filetype : LLVMJoined<"filetype=">, Values<"obj,s,null">,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123545.422032.patch
Type: text/x-patch
Size: 1836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220411/c590d37b/attachment.bin>


More information about the llvm-commits mailing list