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
diff --git a/lldb/source/Commands/CommandObjectArgs.cpp b/lldb/source/Commands/CommandObjectArgs.cpp
index eec83b7..6cd7529 100644
--- a/lldb/source/Commands/CommandObjectArgs.cpp
+++ b/lldb/source/Commands/CommandObjectArgs.cpp
@@ -37,6 +37,12 @@
 // calling functions.
 //
 
+static OptionDefinition g_arg_options[] = {
+    // clang-format off
+  { LLDB_OPT_SET_1, false, "debug", 'g', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable verbose debug logging of the expression parsing and evaluation." },
+    // clang-format on
+};
+
 CommandObjectArgs::CommandOptions::CommandOptions(
     CommandInterpreter &interpreter)
     : Options() {
@@ -61,8 +67,9 @@
 void CommandObjectArgs::CommandOptions::OptionParsingStarting(
     ExecutionContext *execution_context) {}
 
-const OptionDefinition *CommandObjectArgs::CommandOptions::GetDefinitions() {
-  return g_option_table;
+llvm::ArrayRef<OptionDefinition>
+CommandObjectArgs::CommandOptions::GetDefinitions() {
+  return g_arg_options;
 }
 
 CommandObjectArgs::CommandObjectArgs(CommandInterpreter &interpreter)
@@ -228,10 +235,3 @@
 
   return result.Succeeded();
 }
-
-OptionDefinition CommandObjectArgs::CommandOptions::g_option_table[] = {
-    // clang-format off
-  {LLDB_OPT_SET_1, false, "debug", 'g', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable verbose debug logging of the expression parsing and evaluation."},
-  {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-    // clang-format on
-};