Replace "nullptr-terminated" C-arrays of OptionValueEnumeration with safer llvm::ArrayRef

Differential Revision: https://reviews.llvm.org/D49017

llvm-svn: 343130
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 4fc36c7..88d7ef1 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -116,39 +116,39 @@
   }
 };
 
-static PropertyDefinition g_properties[] = {
+static constexpr PropertyDefinition g_properties[] = {
     {"disable-memory-cache", OptionValue::eTypeBoolean, false,
-     DISABLE_MEM_CACHE_DEFAULT, nullptr, nullptr,
+     DISABLE_MEM_CACHE_DEFAULT, nullptr, {},
      "Disable reading and caching of memory in fixed-size units."},
     {"extra-startup-command", OptionValue::eTypeArray, false,
-     OptionValue::eTypeString, nullptr, nullptr,
+     OptionValue::eTypeString, nullptr, {},
      "A list containing extra commands understood by the particular process "
      "plugin used.  "
      "For instance, to turn on debugserver logging set this to "
      "\"QSetLogging:bitmask=LOG_DEFAULT;\""},
     {"ignore-breakpoints-in-expressions", OptionValue::eTypeBoolean, true, true,
-     nullptr, nullptr,
+     nullptr, {},
      "If true, breakpoints will be ignored during expression evaluation."},
     {"unwind-on-error-in-expressions", OptionValue::eTypeBoolean, true, true,
-     nullptr, nullptr, "If true, errors in expression evaluation will unwind "
-                       "the stack back to the state before the call."},
+     nullptr, {}, "If true, errors in expression evaluation will unwind "
+                  "the stack back to the state before the call."},
     {"python-os-plugin-path", OptionValue::eTypeFileSpec, false, true, nullptr,
-     nullptr, "A path to a python OS plug-in module file that contains a "
-              "OperatingSystemPlugIn class."},
+     {}, "A path to a python OS plug-in module file that contains a "
+         "OperatingSystemPlugIn class."},
     {"stop-on-sharedlibrary-events", OptionValue::eTypeBoolean, true, false,
-     nullptr, nullptr,
+     nullptr, {},
      "If true, stop when a shared library is loaded or unloaded."},
     {"detach-keeps-stopped", OptionValue::eTypeBoolean, true, false, nullptr,
-     nullptr, "If true, detach will attempt to keep the process stopped."},
+     {}, "If true, detach will attempt to keep the process stopped."},
     {"memory-cache-line-size", OptionValue::eTypeUInt64, false, 512, nullptr,
-     nullptr, "The memory cache line size"},
+     {}, "The memory cache line size"},
     {"optimization-warnings", OptionValue::eTypeBoolean, false, true, nullptr,
-     nullptr, "If true, warn when stopped in code that is optimized where "
-              "stepping and variable availability may not behave as expected."},
+     {}, "If true, warn when stopped in code that is optimized where "
+         "stepping and variable availability may not behave as expected."},
     {"stop-on-exec", OptionValue::eTypeBoolean, true, true,
-     nullptr, nullptr,
+     nullptr, {},
      "If true, stop when a shared library is loaded or unloaded."},
-    {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, nullptr, nullptr}};
+    {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr}};
 
 enum {
   ePropertyDisableMemCache,
@@ -533,52 +533,52 @@
   return error;
 }
 
-static OptionDefinition g_process_launch_options[] = {
+static constexpr OptionDefinition g_process_launch_options[] = {
     {LLDB_OPT_SET_ALL, false, "stop-at-entry", 's', OptionParser::eNoArgument,
-     nullptr, nullptr, 0, eArgTypeNone,
+     nullptr, {}, 0, eArgTypeNone,
      "Stop at the entry point of the program when launching a process."},
     {LLDB_OPT_SET_ALL, false, "disable-aslr", 'A',
-     OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean,
+     OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean,
      "Set whether to disable address space layout randomization when launching "
      "a process."},
     {LLDB_OPT_SET_ALL, false, "plugin", 'p', OptionParser::eRequiredArgument,
-     nullptr, nullptr, 0, eArgTypePlugin,
+     nullptr, {}, 0, eArgTypePlugin,
      "Name of the process plugin you want to use."},
     {LLDB_OPT_SET_ALL, false, "working-dir", 'w',
-     OptionParser::eRequiredArgument, nullptr, nullptr, 0,
+     OptionParser::eRequiredArgument, nullptr, {}, 0,
      eArgTypeDirectoryName,
      "Set the current working directory to <path> when running the inferior."},
     {LLDB_OPT_SET_ALL, false, "arch", 'a', OptionParser::eRequiredArgument,
-     nullptr, nullptr, 0, eArgTypeArchitecture,
+     nullptr, {}, 0, eArgTypeArchitecture,
      "Set the architecture for the process to launch when ambiguous."},
     {LLDB_OPT_SET_ALL, false, "environment", 'v',
-     OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeNone,
+     OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeNone,
      "Specify an environment variable name/value string (--environment "
      "NAME=VALUE). Can be specified multiple times for subsequent environment "
      "entries."},
     {LLDB_OPT_SET_1 | LLDB_OPT_SET_2 | LLDB_OPT_SET_3, false, "shell", 'c',
-     OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypeFilename,
+     OptionParser::eOptionalArgument, nullptr, {}, 0, eArgTypeFilename,
      "Run the process in a shell (not supported on all platforms)."},
 
     {LLDB_OPT_SET_1, false, "stdin", 'i', OptionParser::eRequiredArgument,
-     nullptr, nullptr, 0, eArgTypeFilename,
+     nullptr, {}, 0, eArgTypeFilename,
      "Redirect stdin for the process to <filename>."},
     {LLDB_OPT_SET_1, false, "stdout", 'o', OptionParser::eRequiredArgument,
-     nullptr, nullptr, 0, eArgTypeFilename,
+     nullptr, {}, 0, eArgTypeFilename,
      "Redirect stdout for the process to <filename>."},
     {LLDB_OPT_SET_1, false, "stderr", 'e', OptionParser::eRequiredArgument,
-     nullptr, nullptr, 0, eArgTypeFilename,
+     nullptr, {}, 0, eArgTypeFilename,
      "Redirect stderr for the process to <filename>."},
 
     {LLDB_OPT_SET_2, false, "tty", 't', OptionParser::eNoArgument, nullptr,
-     nullptr, 0, eArgTypeNone,
+     {}, 0, eArgTypeNone,
      "Start the process in a terminal (not supported on all platforms)."},
 
     {LLDB_OPT_SET_3, false, "no-stdio", 'n', OptionParser::eNoArgument, nullptr,
-     nullptr, 0, eArgTypeNone,
+     {}, 0, eArgTypeNone,
      "Do not set up for terminal I/O to go to running process."},
     {LLDB_OPT_SET_4, false, "shell-expand-args", 'X',
-     OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean,
+     OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean,
      "Set whether to shell expand arguments to the process when launching."},
 };