summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins
diff options
context:
space:
mode:
authorTatyana Krasnukha <tatyana@synopsys.com>2018-09-26 18:50:19 +0000
committerTatyana Krasnukha <tatyana@synopsys.com>2018-09-26 18:50:19 +0000
commit09ee9260309c712d46be844aef00bdda2d8c327e (patch)
treee0bea494ce9c89a8c835412cd7c34ae9c6f68246 /lldb/source/Plugins
parentadc181b995c852b53a1a28a09650acf3d1e1fba0 (diff)
Replace "nullptr-terminated" C-arrays of OptionValueEnumeration with safer llvm::ArrayRef
Differential Revision: https://reviews.llvm.org/D49017
Diffstat (limited to 'lldb/source/Plugins')
-rw-r--r--lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp17
-rw-r--r--lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp6
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp4
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp18
-rw-r--r--lldb/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp6
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp8
-rw-r--r--lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp38
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp9
8 files changed, 52 insertions, 54 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index 51e2ca6acea..92d50378a97 100644
--- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -58,7 +58,7 @@ enum KASLRScanType {
// range looking for a kernel
};
-OptionEnumValueElement g_kaslr_kernel_scan_enum_values[] = {
+static constexpr OptionEnumValueElement g_kaslr_kernel_scan_enum_values[] = {
{eKASLRScanNone, "none",
"Do not read memory looking for a Darwin kernel when attaching."},
{eKASLRScanLowgloAddresses, "basic", "Check for the Darwin kernel's load "
@@ -68,17 +68,16 @@ OptionEnumValueElement g_kaslr_kernel_scan_enum_values[] = {
"the Darwin kernel's load address."},
{eKASLRScanExhaustiveScan, "exhaustive-scan",
"Scan through the entire potential address range of Darwin kernel (only "
- "on 32-bit targets)."},
- {0, NULL, NULL}};
+ "on 32-bit targets)."}};
-static PropertyDefinition g_properties[] = {
- {"load-kexts", OptionValue::eTypeBoolean, true, true, NULL, NULL,
+static constexpr PropertyDefinition g_properties[] = {
+ {"load-kexts", OptionValue::eTypeBoolean, true, true, NULL, {},
"Automatically loads kext images when attaching to a kernel."},
{"scan-type", OptionValue::eTypeEnum, true, eKASLRScanNearPC, NULL,
- 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, 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} };
enum { ePropertyLoadKexts, ePropertyScanType };
diff --git a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
index 7ef3aecdb89..1a2b025c7ea 100644
--- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -59,10 +59,10 @@ template <typename ptr_t> struct jit_descriptor {
namespace {
-PropertyDefinition g_properties[] = {
+static constexpr PropertyDefinition g_properties[] = {
{"enable-jit-breakpoint", OptionValue::eTypeBoolean, true, true, nullptr,
- nullptr, "Enable breakpoint on __jit_debug_register_code."},
- {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, nullptr, nullptr}};
+ {}, "Enable breakpoint on __jit_debug_register_code."},
+ {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr}};
enum { ePropertyEnableJITBreakpoint };
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 122ad85cdda..253e69d038d 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -475,9 +475,9 @@ LanguageRuntime *AppleObjCRuntimeV2::CreateInstance(Process *process,
return NULL;
}
-static OptionDefinition g_objc_classtable_dump_options[] = {
+static constexpr OptionDefinition g_objc_classtable_dump_options[] = {
{LLDB_OPT_SET_ALL, false, "verbose", 'v', OptionParser::eNoArgument,
- nullptr, nullptr, 0, eArgTypeNone,
+ nullptr, {}, 0, eArgTypeNone,
"Print ivar and method information in detail"}};
class CommandObjectObjC_ClassTable_Dump : public CommandObjectParsed {
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index 5434be71450..5961e6ab216 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -4171,13 +4171,13 @@ public:
}
};
-static OptionDefinition g_renderscript_reduction_bp_set_options[] = {
+static constexpr OptionDefinition g_renderscript_reduction_bp_set_options[] = {
{LLDB_OPT_SET_1, false, "function-role", 't',
- OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOneLiner,
+ OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeOneLiner,
"Break on a comma separated set of reduction kernel types "
"(accumulator,outcoverter,combiner,initializer"},
{LLDB_OPT_SET_1, false, "coordinate", 'c', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeValue,
+ 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 "
@@ -4330,9 +4330,9 @@ private:
CommandOptions m_options;
};
-static OptionDefinition g_renderscript_kernel_bp_set_options[] = {
+static constexpr OptionDefinition g_renderscript_kernel_bp_set_options[] = {
{LLDB_OPT_SET_1, false, "coordinate", 'c', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeValue,
+ 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 "
@@ -4602,9 +4602,9 @@ public:
}
};
-static OptionDefinition g_renderscript_runtime_alloc_dump_options[] = {
+static constexpr OptionDefinition g_renderscript_runtime_alloc_dump_options[] = {
{LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgTypeFilename,
+ nullptr, {}, 0, eArgTypeFilename,
"Print results to specified file instead of command line."}};
class CommandObjectRenderScriptRuntimeContext : public CommandObjectMultiword {
@@ -4738,9 +4738,9 @@ private:
CommandOptions m_options;
};
-static OptionDefinition g_renderscript_runtime_alloc_list_options[] = {
+static constexpr OptionDefinition g_renderscript_runtime_alloc_list_options[] = {
{LLDB_OPT_SET_1, false, "id", 'i', OptionParser::eRequiredArgument, nullptr,
- nullptr, 0, eArgTypeIndex,
+ {}, 0, eArgTypeIndex,
"Only show details of a single allocation with specified id."}};
class CommandObjectRenderScriptRuntimeAllocationList
diff --git a/lldb/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp b/lldb/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp
index c8cc1511175..0b17d26a317 100644
--- a/lldb/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp
+++ b/lldb/source/Plugins/OperatingSystem/Go/OperatingSystemGo.cpp
@@ -46,10 +46,10 @@ using namespace lldb_private;
namespace {
-static PropertyDefinition g_properties[] = {
- {"enable", OptionValue::eTypeBoolean, true, true, nullptr, nullptr,
+static constexpr PropertyDefinition g_properties[] = {
+ {"enable", OptionValue::eTypeBoolean, true, true, nullptr, {},
"Specify whether goroutines should be treated as threads."},
- {NULL, OptionValue::eTypeInvalid, false, 0, NULL, NULL, NULL}};
+ {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr}};
enum {
ePropertyEnableGoroutines,
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index cebc06c4d50..b06fc07bb6f 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -110,12 +110,12 @@ void DumpProcessGDBRemotePacketHistory(void *p, const char *path) {
namespace {
-static PropertyDefinition g_properties[] = {
- {"packet-timeout", OptionValue::eTypeUInt64, true, 1, NULL, NULL,
+static constexpr PropertyDefinition g_properties[] = {
+ {"packet-timeout", OptionValue::eTypeUInt64, true, 1, NULL, {},
"Specify the default packet timeout in seconds."},
- {"target-definition-file", OptionValue::eTypeFileSpec, true, 0, NULL, NULL,
+ {"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, NULL}};
+ {NULL, OptionValue::eTypeInvalid, false, 0, NULL, {}, NULL}};
enum { ePropertyPacketTimeout, ePropertyTargetDefinitionFile };
diff --git a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
index e33e26507fb..13af49cb5f5 100644
--- a/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
+++ b/lldb/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp
@@ -112,14 +112,14 @@ void SetGlobalEnableOptions(const DebuggerSP &debugger_sp,
/// Code to handle the StructuredDataDarwinLog settings
//------------------------------------------------------------------
-static PropertyDefinition g_properties[] = {
+static constexpr PropertyDefinition g_properties[] = {
{
"enable-on-startup", // name
OptionValue::eTypeBoolean, // type
true, // global
false, // default uint value
nullptr, // default cstring value
- nullptr, // enum values
+ {}, // enum values
"Enable Darwin os_log collection when debugged process is launched "
"or attached." // description
},
@@ -129,13 +129,13 @@ static PropertyDefinition g_properties[] = {
true, // global
0, // default uint value
"", // default cstring value
- nullptr, // enum values
+ {}, // enum values
"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, nullptr}};
+ {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr}};
enum { ePropertyEnableOnStartup = 0, ePropertyAutoEnableOptions = 1 };
@@ -402,23 +402,23 @@ static void RegisterFilterOperations() {
/// This resets the logging with whatever settings are currently set.
// -------------------------------------------------------------------------
-static OptionDefinition g_enable_option_table[] = {
+static constexpr OptionDefinition g_enable_option_table[] = {
// Source stream include/exclude options (the first-level filter). This one
// should be made as small as possible as everything that goes through here
// must be processed by the process monitor.
{LLDB_OPT_SET_ALL, false, "any-process", 'a', OptionParser::eNoArgument,
- nullptr, nullptr, 0, eArgTypeNone,
+ nullptr, {}, 0, eArgTypeNone,
"Specifies log messages from other related processes should be "
"included."},
{LLDB_OPT_SET_ALL, false, "debug", 'd', OptionParser::eNoArgument, nullptr,
- nullptr, 0, eArgTypeNone,
+ {}, 0, eArgTypeNone,
"Specifies debug-level log messages should be included. Specifying"
" --debug implies --info."},
{LLDB_OPT_SET_ALL, false, "info", 'i', OptionParser::eNoArgument, nullptr,
- nullptr, 0, eArgTypeNone,
+ {}, 0, eArgTypeNone,
"Specifies info-level log messages should be included."},
{LLDB_OPT_SET_ALL, false, "filter", 'f', OptionParser::eRequiredArgument,
- nullptr, nullptr, 0, eArgRawInput,
+ nullptr, {}, 0, eArgRawInput,
// There doesn't appear to be a great way for me to have these multi-line,
// formatted tables in help. This looks mostly right but there are extra
// linefeeds added at seemingly random spots, and indentation isn't
@@ -452,52 +452,52 @@ static OptionDefinition g_enable_option_table[] = {
"Prefer character classes like [[:digit:]] to \\d and the like, as "
"getting the backslashes escaped through properly is error-prone."},
{LLDB_OPT_SET_ALL, false, "live-stream", 'l',
- OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean,
+ OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean,
"Specify whether logging events are live-streamed or buffered. "
"True indicates live streaming, false indicates buffered. The "
"default is true (live streaming). Live streaming will deliver "
"log messages with less delay, but buffered capture mode has less "
"of an observer effect."},
{LLDB_OPT_SET_ALL, false, "no-match-accepts", 'n',
- OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean,
+ OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean,
"Specify whether a log message that doesn't match any filter rule "
"is accepted or rejected, where true indicates accept. The "
"default is true."},
{LLDB_OPT_SET_ALL, false, "echo-to-stderr", 'e',
- OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean,
+ OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean,
"Specify whether os_log()/NSLog() messages are echoed to the "
"target program's stderr. When DarwinLog is enabled, we shut off "
"the mirroring of os_log()/NSLog() to the program's stderr. "
"Setting this flag to true will restore the stderr mirroring."
"The default is false."},
{LLDB_OPT_SET_ALL, false, "broadcast-events", 'b',
- OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean,
+ OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeBoolean,
"Specify if the plugin should broadcast events. Broadcasting "
"log events is a requirement for displaying the log entries in "
"LLDB command-line. It is also required if LLDB clients want to "
"process log events. The default is true."},
// Message formatting options
{LLDB_OPT_SET_ALL, false, "timestamp-relative", 'r',
- OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone,
+ OptionParser::eNoArgument, nullptr, {}, 0, eArgTypeNone,
"Include timestamp in the message header when printing a log "
"message. The timestamp is relative to the first displayed "
"message."},
{LLDB_OPT_SET_ALL, false, "subsystem", 's', OptionParser::eNoArgument,
- nullptr, nullptr, 0, eArgTypeNone,
+ nullptr, {}, 0, eArgTypeNone,
"Include the subsystem in the the message header when displaying "
"a log message."},
{LLDB_OPT_SET_ALL, false, "category", 'c', OptionParser::eNoArgument,
- nullptr, nullptr, 0, eArgTypeNone,
- "Include the category in the message header when displaying "
+ nullptr, {}, 0, eArgTypeNone,
+ "Include the category in the the message header when displaying "
"a log message."},
{LLDB_OPT_SET_ALL, false, "activity-chain", 'C', OptionParser::eNoArgument,
- nullptr, nullptr, 0, eArgTypeNone,
+ nullptr, {}, 0, eArgTypeNone,
"Include the activity parent-child chain in the message header "
"when displaying a log message. The activity hierarchy is "
"displayed as {grandparent-activity}:"
"{parent-activity}:{activity}[:...]."},
{LLDB_OPT_SET_ALL, false, "all-fields", 'A', OptionParser::eNoArgument,
- nullptr, nullptr, 0, eArgTypeNone,
+ nullptr, {}, 0, eArgTypeNone,
"Shortcut to specify that all header fields should be displayed."}};
class EnableOptions : public Options {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 5c9ad9d516f..f895c9e376c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -111,16 +111,15 @@ using namespace lldb_private;
namespace {
-PropertyDefinition g_properties[] = {
+static constexpr PropertyDefinition g_properties[] = {
{"comp-dir-symlink-paths", OptionValue::eTypeFileSpecList, true, 0, nullptr,
- nullptr,
+ {},
"If the DW_AT_comp_dir matches any of these paths the symbolic "
"links will be resolved at DWARF parse time."},
- {"ignore-file-indexes", OptionValue::eTypeBoolean, true, 0, nullptr,
- nullptr,
+ {"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, nullptr},
+ {nullptr, OptionValue::eTypeInvalid, false, 0, nullptr, {}, nullptr},
};
enum {