summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-09-22 20:22:55 +0000
committerZachary Turner <zturner@google.com>2016-09-22 20:22:55 +0000
commit1f0f5b5b9eeaea93126583b40070091baf3bc92d (patch)
tree93be6068ce5a7314fb9bfdf0621f65c03b3cad0b /lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
parent387eb83a509926ed6bd36591d1f235335ec215c0 (diff)
downloadbcm5719-llvm-1f0f5b5b9eeaea93126583b40070091baf3bc92d.tar.gz
bcm5719-llvm-1f0f5b5b9eeaea93126583b40070091baf3bc92d.zip
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the signature of `Options::GetDefinitions()` and `OptionGroup:: GetDefinitions()` to return an `ArrayRef<OptionDefinition>` instead of a `const OptionDefinition *`. In the case of the former, it deletes the sentinel entry from every table, and in the case of the latter, it removes the `GetNumDefinitions()` method from the interface. These are no longer necessary as `ArrayRef` carries its own length. In the former case, iteration was done by using a sentinel entry, so there was no knowledge of length. Because of this the individual option tables were allowed to be defined below the corresponding class (after all, only a pointer was needed). Now, however, the length must be known at compile time to construct the `ArrayRef`, and as a result it is necessary to move every option table before its corresponding class. This results in this CL looking very big, but in terms of substance there is not much here. Differential revision: https://reviews.llvm.org/D24834 llvm-svn: 282188
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp')
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp57
1 files changed, 27 insertions, 30 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index 9d751a75da0..1e4d846a898 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -3692,6 +3692,15 @@ public:
}
};
+static OptionDefinition g_renderscript_kernel_bp_set_options[] = {
+ {LLDB_OPT_SET_1, false, "coordinate", 'c', OptionParser::eRequiredArgument,
+ nullptr, nullptr, 0, eArgTypeValue,
+ "Set a breakpoint on a single invocation of the kernel with specified "
+ "coordinate.\n"
+ "Coordinate takes the form 'x[,y][,z] where x,y,z are positive "
+ "integers representing kernel dimensions. "
+ "Any unset dimensions will be defaulted to zero."}};
+
class CommandObjectRenderScriptRuntimeKernelBreakpointSet
: public CommandObjectParsed {
public:
@@ -3770,9 +3779,10 @@ public:
m_coord[2] = -1;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_renderscript_kernel_bp_set_options;
+ }
- static OptionDefinition g_option_table[];
std::array<int, 3> m_coord;
};
@@ -3809,17 +3819,6 @@ private:
CommandOptions m_options;
};
-OptionDefinition CommandObjectRenderScriptRuntimeKernelBreakpointSet::
- CommandOptions::g_option_table[] = {
- {LLDB_OPT_SET_1, false, "coordinate", 'c',
- OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeValue,
- "Set a breakpoint on a single invocation of the kernel with specified "
- "coordinate.\n"
- "Coordinate takes the form 'x[,y][,z] where x,y,z are positive "
- "integers representing kernel dimensions. "
- "Any unset dimensions will be defaulted to zero."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}};
-
class CommandObjectRenderScriptRuntimeKernelBreakpointAll
: public CommandObjectParsed {
public:
@@ -3972,6 +3971,11 @@ public:
}
};
+static OptionDefinition g_renderscript_runtime_alloc_dump_options[] = {
+ {LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument,
+ nullptr, nullptr, 0, eArgTypeFilename,
+ "Print results to specified file instead of command line."}};
+
class CommandObjectRenderScriptRuntimeContext : public CommandObjectMultiword {
public:
CommandObjectRenderScriptRuntimeContext(CommandInterpreter &interpreter)
@@ -4034,9 +4038,10 @@ public:
m_outfile.Clear();
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_renderscript_runtime_alloc_dump_options;
+ }
- static OptionDefinition g_option_table[];
FileSpec m_outfile;
};
@@ -4103,12 +4108,10 @@ private:
CommandOptions m_options;
};
-OptionDefinition CommandObjectRenderScriptRuntimeAllocationDump::
- CommandOptions::g_option_table[] = {
- {LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeFilename,
- "Print results to specified file instead of command line."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}};
+static OptionDefinition g_renderscript_runtime_alloc_list_options[] = {
+ {LLDB_OPT_SET_1, false, "id", 'i', OptionParser::eRequiredArgument, nullptr,
+ nullptr, 0, eArgTypeIndex,
+ "Only show details of a single allocation with specified id."}};
class CommandObjectRenderScriptRuntimeAllocationList
: public CommandObjectParsed {
@@ -4157,9 +4160,10 @@ public:
m_id = 0;
}
- const OptionDefinition *GetDefinitions() override { return g_option_table; }
+ llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+ return g_renderscript_runtime_alloc_list_options;
+ }
- static OptionDefinition g_option_table[];
uint32_t m_id;
};
@@ -4177,13 +4181,6 @@ private:
CommandOptions m_options;
};
-OptionDefinition CommandObjectRenderScriptRuntimeAllocationList::
- CommandOptions::g_option_table[] = {
- {LLDB_OPT_SET_1, false, "id", 'i', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeIndex,
- "Only show details of a single allocation with specified id."},
- {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}};
-
class CommandObjectRenderScriptRuntimeAllocationLoad
: public CommandObjectParsed {
public:
OpenPOWER on IntegriCloud