tatyana-krasnukha created this revision.
tatyana-krasnukha added reviewers: clayborg, zturner, jingham.
tatyana-krasnukha added a project: LLDB.
Herald added subscribers: lldb-commits, teemperor, JDevlieghere.

As a follow-up to https://reviews.llvm.org/D49017.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D52572

Files:
  include/lldb/Interpreter/OptionValueProperties.h
  include/lldb/Interpreter/Property.h
  source/Core/Debugger.cpp
  source/Core/ModuleList.cpp
  source/Interpreter/CommandInterpreter.cpp
  source/Interpreter/OptionValueProperties.cpp
  source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
  source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp
  source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
  source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Target/Platform.cpp
  source/Target/Process.cpp
  source/Target/Target.cpp
  source/Target/Thread.cpp

Index: source/Target/Thread.cpp
===================================================================
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -80,8 +80,7 @@
     {"trace-thread", OptionValue::eTypeBoolean, false, false, nullptr, {},
      "If true, this thread will single-step and log execution."},
     {"max-backtrace-depth", OptionValue::eTypeUInt64, false, 300000, nullptr,
-     {}, "Maximum number of frames to backtrace."},
-    {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr}};
+     {}, "Maximum number of frames to backtrace."}};
 
 enum {
   ePropertyStepInAvoidsNoDebug,
Index: source/Target/Target.cpp
===================================================================
--- source/Target/Target.cpp
+++ source/Target/Target.cpp
@@ -3352,8 +3352,7 @@
      nullptr, {}, "If true, LLDB will show variables that are meant to "
                   "support the operation of a language's runtime support."},
     {"non-stop-mode", OptionValue::eTypeBoolean, false, 0, nullptr, {},
-     "Disable lock-step debugging, instead control threads independently."},
-    {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr}};
+     "Disable lock-step debugging, instead control threads independently."}};
 
 enum {
   ePropertyDefaultArch,
@@ -3483,8 +3482,7 @@
      "ivars and local variables.  "
      "But it can make expressions run much more slowly."},
     {"use-modern-type-lookup", OptionValue::eTypeBoolean, true, false, nullptr,
-     {}, "If true, use Clang's modern type lookup infrastructure."},
-    {nullptr, OptionValue::eTypeInvalid, true, 0, nullptr, {}, nullptr}};
+     {}, "If true, use Clang's modern type lookup infrastructure."}};
 
 enum { ePropertyInjectLocalVars = 0, ePropertyUseModernTypeLookup };
 
Index: source/Target/Process.cpp
===================================================================
--- source/Target/Process.cpp
+++ source/Target/Process.cpp
@@ -147,8 +147,7 @@
          "stepping and variable availability may not behave as expected."},
     {"stop-on-exec", OptionValue::eTypeBoolean, true, true,
      nullptr, {},
-     "If true, stop when a shared library is loaded or unloaded."},
-    {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr}};
+     "If true, stop when a shared library is loaded or unloaded."}};
 
 enum {
   ePropertyDisableMemCache,
Index: source/Target/Platform.cpp
===================================================================
--- source/Target/Platform.cpp
+++ source/Target/Platform.cpp
@@ -71,8 +71,7 @@
     {"use-module-cache", OptionValue::eTypeBoolean, true, true, nullptr,
      {}, "Use module cache."},
     {"module-cache-directory", OptionValue::eTypeFileSpec, true, 0, nullptr,
-     {}, "Root directory for cached modules."},
-    {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr}};
+     {}, "Root directory for cached modules."}};
 
 enum { ePropertyUseModuleCache, ePropertyModuleCacheDirectory };
 
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -118,9 +118,7 @@
      "links will be resolved at DWARF parse time."},
     {"ignore-file-indexes", OptionValue::eTypeBoolean, true, 0, nullptr, {},
      "Ignore indexes present in the object files and always index DWARF "
-     "manually."},
-    {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr},
-};
+     "manually."}};
 
 enum {
   ePropertySymLinkPaths,
Index: source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
===================================================================
--- source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -133,9 +133,7 @@
         "Specify the options to 'plugin structured-data darwin-log enable' "
         "that should be applied when automatically enabling logging on "
         "startup/attach." // description
-    },
-    // Last entry sentinel.
-    {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr}};
+    }};
 
 enum { ePropertyEnableOnStartup = 0, ePropertyAutoEnableOptions = 1 };
 
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -114,8 +114,7 @@
     {"packet-timeout", OptionValue::eTypeUInt64, true, 1, NULL, {},
      "Specify the default packet timeout in seconds."},
     {"target-definition-file", OptionValue::eTypeFileSpec, true, 0, NULL, {},
-     "The file that provides the description for remote target registers."},
-    {NULL, OptionValue::eTypeInvalid, false, 0, NULL, {}, NULL}};
+     "The file that provides the description for remote target registers."}};
 
 enum { ePropertyPacketTimeout, ePropertyTargetDefinitionFile };
 
Index: source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
===================================================================
--- source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -55,10 +55,9 @@
 
 namespace {
 
-static PropertyDefinition g_properties[] = {
+static constexpr PropertyDefinition g_properties[] = {
     {"packet-timeout", OptionValue::eTypeUInt64, true, 5, NULL, {},
-     "Specify the default packet timeout in seconds."},
-    {NULL, OptionValue::eTypeInvalid, false, 0, NULL, {}, NULL}};
+     "Specify the default packet timeout in seconds."}};
 
 enum { ePropertyPacketTimeout };
 
Index: source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
===================================================================
--- source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -186,14 +186,13 @@
 /// Code to handle the PlatformDarwinKernel settings
 //------------------------------------------------------------------
 
-static PropertyDefinition g_properties[] = {
+static constexpr PropertyDefinition g_properties[] = {
     {"search-locally-for-kexts", OptionValue::eTypeBoolean, true, true, NULL,
      {}, "Automatically search for kexts on the local system when doing "
            "kernel debugging."},
     {"kext-directories", OptionValue::eTypeFileSpecList, false, 0, NULL, {},
      "Directories/KDKs to search for kexts in when starting a kernel debug "
-     "session."},
-    {NULL, OptionValue::eTypeInvalid, false, 0, NULL, {}, NULL}};
+     "session."}};
 
 enum { ePropertySearchForKexts = 0, ePropertyKextDirectories };
 
Index: source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp
===================================================================
--- source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp
+++ source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp
@@ -48,8 +48,7 @@
 
 static constexpr PropertyDefinition g_properties[] = {
     {"enable", OptionValue::eTypeBoolean, true, true, nullptr, {},
-     "Specify whether goroutines should be treated as threads."},
-    {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr}};
+     "Specify whether goroutines should be treated as threads."}};
 
 enum {
   ePropertyEnableGoroutines,
Index: source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
===================================================================
--- source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -61,8 +61,7 @@
 
 static constexpr PropertyDefinition g_properties[] = {
     {"enable-jit-breakpoint", OptionValue::eTypeBoolean, true, true, nullptr,
-     {}, "Enable breakpoint on __jit_debug_register_code."},
-    {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr}};
+     {}, "Enable breakpoint on __jit_debug_register_code."}};
 
 enum { ePropertyEnableJITBreakpoint };
 
Index: source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
===================================================================
--- source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -76,8 +76,7 @@
     {"scan-type", OptionValue::eTypeEnum, true, eKASLRScanNearPC, NULL,
      OptionEnumValues(g_kaslr_kernel_scan_enum_values),
      "Control how many reads lldb will make while searching for a Darwin "
-     "kernel on attach."},
-    {NULL, OptionValue::eTypeInvalid, false, 0, NULL, {}, NULL} };
+     "kernel on attach."}};
 
 enum { ePropertyLoadKexts, ePropertyScanType };
 
Index: source/Interpreter/OptionValueProperties.cpp
===================================================================
--- source/Interpreter/OptionValueProperties.cpp
+++ source/Interpreter/OptionValueProperties.cpp
@@ -53,9 +53,9 @@
   return m_properties.size();
 }
 
-void OptionValueProperties::Initialize(const PropertyDefinition *defs) {
-  for (size_t i = 0; defs[i].name; ++i) {
-    Property property(defs[i]);
+void OptionValueProperties::Initialize(const PropertyDefinitions &defs) {
+  for (const auto &definition : defs) {
+    Property property(definition);
     assert(property.IsValid());
     m_name_to_index.Append(ConstString(property.GetName()), m_properties.size());
     property.GetValue()->SetParent(shared_from_this());
Index: source/Interpreter/CommandInterpreter.cpp
===================================================================
--- source/Interpreter/CommandInterpreter.cpp
+++ source/Interpreter/CommandInterpreter.cpp
@@ -89,8 +89,7 @@
      nullptr, {}, "If true, LLDB will stop running a 'command source' "
                   "script upon encountering an error."},
     {"space-repl-prompts", OptionValue::eTypeBoolean, true, false, nullptr, {},
-     "If true, blank lines will be printed between between REPL submissions."},
-    {nullptr, OptionValue::eTypeInvalid, true, 0, nullptr, {}, nullptr}};
+     "If true, blank lines will be printed between between REPL submissions."}};
 
 enum {
   ePropertyExpandRegexAliases = 0,
Index: source/Core/ModuleList.cpp
===================================================================
--- source/Core/ModuleList.cpp
+++ source/Core/ModuleList.cpp
@@ -74,8 +74,7 @@
      "the UUID of the executable."},
     {"clang-modules-cache-path", OptionValue::eTypeFileSpec, true, 0, nullptr,
      {},
-     "The path to the clang modules cache directory (-fmodules-cache-path)."},
-    {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr}};
+     "The path to the clang modules cache directory (-fmodules-cache-path)."}};
 
 enum { ePropertyEnableExternalLookup, ePropertyClangModulesCachePath };
 
Index: source/Core/Debugger.cpp
===================================================================
--- source/Core/Debugger.cpp
+++ source/Core/Debugger.cpp
@@ -278,8 +278,7 @@
     {"frame-format-unique", OptionValue::eTypeFormatEntity, true, 0,
      DEFAULT_FRAME_FORMAT_NO_ARGS, {},
      "The default frame format string to use when displaying stack frame"
-     "information for threads from thread backtrace unique."},
-    {nullptr, OptionValue::eTypeInvalid, true, 0, nullptr, {}, nullptr}};
+     "information for threads from thread backtrace unique."}};
 
 enum {
   ePropertyAutoConfirm = 0,
Index: include/lldb/Interpreter/Property.h
===================================================================
--- include/lldb/Interpreter/Property.h
+++ include/lldb/Interpreter/Property.h
@@ -32,6 +32,8 @@
   const char *description;
 };
 
+using PropertyDefinitions = llvm::ArrayRef<PropertyDefinition>;
+
 class Property {
 public:
   Property(const PropertyDefinition &definition);
Index: include/lldb/Interpreter/OptionValueProperties.h
===================================================================
--- include/lldb/Interpreter/OptionValueProperties.h
+++ include/lldb/Interpreter/OptionValueProperties.h
@@ -62,7 +62,7 @@
   void Apropos(llvm::StringRef keyword,
                std::vector<const Property *> &matching_properties) const;
 
-  void Initialize(const PropertyDefinition *setting_definitions);
+  void Initialize(const PropertyDefinitions &setting_definitions);
 
   //    bool
   //    GetQualifiedName (Stream &strm);
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to