From bd68a052f292b5df7c5717bd880d796ac7507fc0 Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Sun, 28 Jul 2019 06:24:07 +0000 Subject: [lldb] Also include the array definition in CommandOptions.inc Summary: Right now our CommandOptions.inc only generates the initializer for the options list but not the array declaration boilerplate around it. As the array definition is identical for all arrays, we might as well also let the CommandOptions.inc generate it alongside the initializers. This patch will also allow us to generate additional declarations related to that option list in the future (e.g. a enum class representing the specific options which would make our handling code less prone). This patch also fixes a few option tables that didn't follow our naming style. Reviewers: JDevlieghere Reviewed By: JDevlieghere Subscribers: abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D65331 llvm-svn: 367186 --- lldb/source/Commands/CommandObjectTarget.cpp | 32 +++++++--------------------- 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'lldb/source/Commands/CommandObjectTarget.cpp') diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 889f95a5570..cf464d2bac2 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -144,10 +144,8 @@ static constexpr OptionEnumValueElement g_dependents_enumaration[] = { {eLoadDependentsYes, "false", "Load dependents, even if the target is not an executable."}}; -static constexpr OptionDefinition g_dependents_options[] = { #define LLDB_OPTIONS_target_dependents #include "CommandOptions.inc" -}; class OptionGroupDependents : public OptionGroup { public: @@ -156,7 +154,7 @@ public: ~OptionGroupDependents() override {} llvm::ArrayRef GetDefinitions() override { - return llvm::makeArrayRef(g_dependents_options); + return llvm::makeArrayRef(g_target_dependents_options); } Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, @@ -169,11 +167,13 @@ public: return error; } - const char short_option = g_dependents_options[option_idx].short_option; + const char short_option = + g_target_dependents_options[option_idx].short_option; if (short_option == 'd') { LoadDependentFiles tmp_load_dependents; tmp_load_dependents = (LoadDependentFiles)OptionArgParser::ToOptionEnum( - option_value, g_dependents_options[option_idx].enum_values, 0, error); + option_value, g_target_dependents_options[option_idx].enum_values, 0, + error); if (error.Success()) m_load_dependent_files = tmp_load_dependents; } else { @@ -1964,10 +1964,8 @@ static constexpr OptionEnumValueElement g_sort_option_enumeration[] = { {eSortOrderByAddress, "address", "Sort output by symbol address."}, {eSortOrderByName, "name", "Sort output by symbol name."} }; -static constexpr OptionDefinition g_target_modules_dump_symtab_options[] = { #define LLDB_OPTIONS_target_modules_dump_symtab #include "CommandOptions.inc" -}; class CommandObjectTargetModulesDumpSymtab : public CommandObjectTargetModulesModuleAutoComplete { @@ -2364,6 +2362,8 @@ protected: }; #pragma mark CommandObjectTargetModulesDumpLineTable +#define LLDB_OPTIONS_target_modules_dump +#include "CommandOptions.inc" // Image debug line table dumping command @@ -2452,11 +2452,7 @@ protected: } llvm::ArrayRef GetDefinitions() override { - static constexpr OptionDefinition g_options[] = { -#define LLDB_OPTIONS_target_modules_dump -#include "CommandOptions.inc" - }; - return llvm::makeArrayRef(g_options); + return llvm::makeArrayRef(g_target_modules_dump_options); } bool m_verbose; @@ -2958,11 +2954,8 @@ protected: }; // List images with associated information - -static constexpr OptionDefinition g_target_modules_list_options[] = { #define LLDB_OPTIONS_target_modules_list #include "CommandOptions.inc" -}; class CommandObjectTargetModulesList : public CommandObjectParsed { public: @@ -3307,11 +3300,8 @@ protected: #pragma mark CommandObjectTargetModulesShowUnwind // Lookup unwind information in images - -static constexpr OptionDefinition g_target_modules_show_unwind_options[] = { #define LLDB_OPTIONS_target_modules_show_unwind #include "CommandOptions.inc" -}; class CommandObjectTargetModulesShowUnwind : public CommandObjectParsed { public: @@ -3616,11 +3606,8 @@ protected: }; // Lookup information in images - -static constexpr OptionDefinition g_target_modules_lookup_options[] = { #define LLDB_OPTIONS_target_modules_lookup #include "CommandOptions.inc" -}; class CommandObjectTargetModulesLookup : public CommandObjectParsed { public: @@ -4471,11 +4458,8 @@ private: #pragma mark CommandObjectTargetStopHookAdd // CommandObjectTargetStopHookAdd - -static constexpr OptionDefinition g_target_stop_hook_add_options[] = { #define LLDB_OPTIONS_target_stop_hook_add #include "CommandOptions.inc" -}; class CommandObjectTargetStopHookAdd : public CommandObjectParsed, public IOHandlerDelegateMultiline { -- cgit v1.2.3