diff options
author | Raphael Isemann <teemperor@gmail.com> | 2019-07-28 06:24:07 +0000 |
---|---|---|
committer | Raphael Isemann <teemperor@gmail.com> | 2019-07-28 06:24:07 +0000 |
commit | bd68a052f292b5df7c5717bd880d796ac7507fc0 (patch) | |
tree | cca9c6eb174d5c2b71c5adaab65674bc3b370416 /lldb/source/Commands/CommandObjectMemory.cpp | |
parent | afd4a37b2a35d730a85a26d21428034915bd5b3f (diff) | |
download | bcm5719-llvm-bd68a052f292b5df7c5717bd880d796ac7507fc0.tar.gz bcm5719-llvm-bd68a052f292b5df7c5717bd880d796ac7507fc0.zip |
[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
Diffstat (limited to 'lldb/source/Commands/CommandObjectMemory.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectMemory.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index 7409915665f..ac6abc32588 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -46,10 +46,8 @@ using namespace lldb; using namespace lldb_private; -static constexpr OptionDefinition g_read_memory_options[] = { #define LLDB_OPTIONS_memory_read #include "CommandOptions.inc" -}; class OptionGroupReadMemory : public OptionGroup { public: @@ -60,13 +58,13 @@ public: ~OptionGroupReadMemory() override = default; llvm::ArrayRef<OptionDefinition> GetDefinitions() override { - return llvm::makeArrayRef(g_read_memory_options); + return llvm::makeArrayRef(g_memory_read_options); } Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override { Status error; - const int short_option = g_read_memory_options[option_idx].short_option; + const int short_option = g_memory_read_options[option_idx].short_option; switch (short_option) { case 'l': @@ -896,10 +894,8 @@ protected: CompilerType m_prev_compiler_type; }; -static constexpr OptionDefinition g_memory_find_option_table[] = { #define LLDB_OPTIONS_memory_find #include "CommandOptions.inc" -}; // Find the specified data in memory class CommandObjectMemoryFind : public CommandObjectParsed { @@ -911,14 +907,13 @@ public: ~OptionGroupFindMemory() override = default; llvm::ArrayRef<OptionDefinition> GetDefinitions() override { - return llvm::makeArrayRef(g_memory_find_option_table); + return llvm::makeArrayRef(g_memory_find_options); } Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override { Status error; - const int short_option = - g_memory_find_option_table[option_idx].short_option; + const int short_option = g_memory_find_options[option_idx].short_option; switch (short_option) { case 'e': @@ -1189,10 +1184,8 @@ protected: OptionGroupFindMemory m_memory_options; }; -static constexpr OptionDefinition g_memory_write_option_table[] = { #define LLDB_OPTIONS_memory_write #include "CommandOptions.inc" -}; // Write memory to the inferior process class CommandObjectMemoryWrite : public CommandObjectParsed { @@ -1204,14 +1197,13 @@ public: ~OptionGroupWriteMemory() override = default; llvm::ArrayRef<OptionDefinition> GetDefinitions() override { - return llvm::makeArrayRef(g_memory_write_option_table); + return llvm::makeArrayRef(g_memory_write_options); } Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override { Status error; - const int short_option = - g_memory_write_option_table[option_idx].short_option; + const int short_option = g_memory_write_options[option_idx].short_option; switch (short_option) { case 'i': |