From 7ced9fff95473c1794b51a3cfd099b4fea3d1a58 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 13 Jul 2022 20:11:37 -0700 Subject: [lldb] Refactor command option enum values (NFC) Refactor the command option enum values and the command argument table to connect the two. This has two benefits: - We guarantee that two options that use the same argument type have the same accepted values. - We can print the enum values and their description in the help output. (D129707) Differential revision: https://reviews.llvm.org/D129703 --- lldb/utils/TableGen/LLDBOptionDefEmitter.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'lldb/utils/TableGen/LLDBOptionDefEmitter.cpp') diff --git a/lldb/utils/TableGen/LLDBOptionDefEmitter.cpp b/lldb/utils/TableGen/LLDBOptionDefEmitter.cpp index ccf4827..d73f0a2 100644 --- a/lldb/utils/TableGen/LLDBOptionDefEmitter.cpp +++ b/lldb/utils/TableGen/LLDBOptionDefEmitter.cpp @@ -31,7 +31,6 @@ struct CommandOption { std::string ArgType; bool OptionalArg = false; std::string Validator; - std::string ArgEnum; std::vector Completions; std::string Description; @@ -65,9 +64,6 @@ struct CommandOption { if (Option->getValue("Validator")) Validator = std::string(Option->getValueAsString("Validator")); - if (Option->getValue("ArgEnum")) - ArgEnum = std::string(Option->getValueAsString("ArgEnum")); - if (Option->getValue("Completions")) Completions = Option->getValueAsListOfStrings("Completions"); @@ -114,8 +110,8 @@ static void emitOption(const CommandOption &O, raw_ostream &OS) { OS << "nullptr"; OS << ", "; - if (!O.ArgEnum.empty()) - OS << O.ArgEnum; + if (!O.ArgType.empty()) + OS << "g_argument_table[eArgType" << O.ArgType << "].enum_values"; else OS << "{}"; OS << ", "; -- cgit v1.1