[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
This commit is contained in:
Eric Astor 2022-04-21 10:01:02 -04:00
parent e06290e53f
commit 82ecf9a0b1
2 changed files with 13 additions and 0 deletions

View File

@ -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">,

View File

@ -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",