[llvm] 82ecf9a - [LLVM-ML] Add standard LLVM debug flags

Eric Astor via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 07:15:10 PDT 2022


Author: Eric Astor
Date: 2022-04-21T10:14:59-04:00
New Revision: 82ecf9a0b1b3b90e99e90cb16f4bff78c4e8be3c

URL: https://github.com/llvm/llvm-project/commit/82ecf9a0b1b3b90e99e90cb16f4bff78c4e8be3c
DIFF: https://github.com/llvm/llvm-project/commit/82ecf9a0b1b3b90e99e90cb16f4bff78c4e8be3c.diff

LOG: [LLVM-ML] Add standard LLVM debug flags

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

Reviewed By: ayzhao

Differential Revision: https://reviews.llvm.org/D123545

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-ml/Opts.td b/llvm/tools/llvm-ml/Opts.td
index a6759ad6bfbb9..9cd1e91ecbb55 100644
--- a/llvm/tools/llvm-ml/Opts.td
+++ b/llvm/tools/llvm-ml/Opts.td
@@ -7,6 +7,7 @@ class LLVMFlag<string name> : Flag<["--", "-"], name>;
 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 @@ def bitness : LLVMJoined<"m">, Values<"32,64">,
               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">,

diff  --git a/llvm/tools/llvm-ml/llvm-ml.cpp b/llvm/tools/llvm-ml/llvm-ml.cpp
index 1be820b5bf399..2fd218a0c907b 100644
--- a/llvm/tools/llvm-ml/llvm-ml.cpp
+++ b/llvm/tools/llvm-ml/llvm-ml.cpp
@@ -243,6 +243,13 @@ int main(int Argc, char **Argv) {
         << "' 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",


        


More information about the llvm-commits mailing list