Author: tkrasnukha Date: Thu Sep 27 00:11:58 2018 New Revision: 343181 URL: http://llvm.org/viewvc/llvm-project?rev=343181&view=rev Log: Replace pointer to C-array of PropertyDefinition with llvm::ArrayRef
Differential Revision: https://reviews.llvm.org/D52572 Modified: lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h lldb/trunk/include/lldb/Interpreter/Property.h lldb/trunk/source/Core/Debugger.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Interpreter/OptionValueProperties.cpp lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Target/Platform.cpp lldb/trunk/source/Target/Process.cpp lldb/trunk/source/Target/Target.cpp lldb/trunk/source/Target/Thread.cpp Modified: lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h (original) +++ lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h Thu Sep 27 00:11:58 2018 @@ -62,7 +62,7 @@ public: 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); Modified: lldb/trunk/include/lldb/Interpreter/Property.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Property.h?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/include/lldb/Interpreter/Property.h (original) +++ lldb/trunk/include/lldb/Interpreter/Property.h Thu Sep 27 00:11:58 2018 @@ -32,6 +32,8 @@ struct PropertyDefinition { const char *description; }; +using PropertyDefinitions = llvm::ArrayRef<PropertyDefinition>; + class Property { public: Property(const PropertyDefinition &definition); Modified: lldb/trunk/source/Core/Debugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Core/Debugger.cpp (original) +++ lldb/trunk/source/Core/Debugger.cpp Thu Sep 27 00:11:58 2018 @@ -278,8 +278,7 @@ static constexpr PropertyDefinition g_pr {"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, Modified: lldb/trunk/source/Core/ModuleList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Core/ModuleList.cpp (original) +++ lldb/trunk/source/Core/ModuleList.cpp Thu Sep 27 00:11:58 2018 @@ -74,8 +74,7 @@ static constexpr PropertyDefinition g_pr "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 }; Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Thu Sep 27 00:11:58 2018 @@ -89,8 +89,7 @@ static constexpr PropertyDefinition g_pr 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, Modified: lldb/trunk/source/Interpreter/OptionValueProperties.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueProperties.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Interpreter/OptionValueProperties.cpp (original) +++ lldb/trunk/source/Interpreter/OptionValueProperties.cpp Thu Sep 27 00:11:58 2018 @@ -53,9 +53,9 @@ size_t OptionValueProperties::GetNumProp 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()); Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Thu Sep 27 00:11:58 2018 @@ -76,8 +76,7 @@ static constexpr PropertyDefinition g_pr {"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 }; Modified: lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp (original) +++ lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp Thu Sep 27 00:11:58 2018 @@ -61,8 +61,7 @@ namespace { 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 }; Modified: lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp (original) +++ lldb/trunk/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp Thu Sep 27 00:11:58 2018 @@ -48,8 +48,7 @@ namespace { 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, Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original) +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Thu Sep 27 00:11:58 2018 @@ -186,14 +186,13 @@ const char *PlatformDarwinKernel::GetDes /// 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 }; Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original) +++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Thu Sep 27 00:11:58 2018 @@ -55,10 +55,9 @@ using namespace lldb_private; 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 }; Modified: lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (original) +++ lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Thu Sep 27 00:11:58 2018 @@ -114,8 +114,7 @@ static constexpr PropertyDefinition g_pr {"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 }; Modified: lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp (original) +++ lldb/trunk/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp Thu Sep 27 00:11:58 2018 @@ -133,9 +133,7 @@ static constexpr PropertyDefinition g_pr "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 }; Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Sep 27 00:11:58 2018 @@ -118,9 +118,7 @@ static constexpr PropertyDefinition g_pr "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, Modified: lldb/trunk/source/Target/Platform.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Target/Platform.cpp (original) +++ lldb/trunk/source/Target/Platform.cpp Thu Sep 27 00:11:58 2018 @@ -71,8 +71,7 @@ static constexpr PropertyDefinition g_pr {"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 }; Modified: lldb/trunk/source/Target/Process.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Target/Process.cpp (original) +++ lldb/trunk/source/Target/Process.cpp Thu Sep 27 00:11:58 2018 @@ -147,8 +147,7 @@ static constexpr PropertyDefinition g_pr "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, Modified: lldb/trunk/source/Target/Target.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Target/Target.cpp (original) +++ lldb/trunk/source/Target/Target.cpp Thu Sep 27 00:11:58 2018 @@ -3352,8 +3352,7 @@ static constexpr PropertyDefinition g_pr 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 @@ static constexpr PropertyDefinition g_ex "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 }; Modified: lldb/trunk/source/Target/Thread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=343181&r1=343180&r2=343181&view=diff ============================================================================== --- lldb/trunk/source/Target/Thread.cpp (original) +++ lldb/trunk/source/Target/Thread.cpp Thu Sep 27 00:11:58 2018 @@ -80,8 +80,7 @@ static constexpr PropertyDefinition g_pr {"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, _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits