summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter/OptionGroupWatchpoint.cpp
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
commit8fe53c490a567d3e9337b974057a239477dbe685 (patch)
tree66605824e7ac9bdd8691bc9fef8415a5f62ab62d /lldb/source/Interpreter/OptionGroupWatchpoint.cpp
parentbcdfcbcb1d8694c0f0630e3c326cbda437b24c14 (diff)
downloadbcm5719-llvm-8fe53c490a567d3e9337b974057a239477dbe685.tar.gz
bcm5719-llvm-8fe53c490a567d3e9337b974057a239477dbe685.zip
Replace "nullptr-terminated" C-arrays of OptionValueEnumeration with safer llvm::ArrayRef
Differential Revision: https://reviews.llvm.org/D49017 llvm-svn: 343130
Diffstat (limited to 'lldb/source/Interpreter/OptionGroupWatchpoint.cpp')
-rw-r--r--lldb/source/Interpreter/OptionGroupWatchpoint.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/lldb/source/Interpreter/OptionGroupWatchpoint.cpp b/lldb/source/Interpreter/OptionGroupWatchpoint.cpp
index 0431fefaa7f..6cfcf1861fa 100644
--- a/lldb/source/Interpreter/OptionGroupWatchpoint.cpp
+++ b/lldb/source/Interpreter/OptionGroupWatchpoint.cpp
@@ -20,33 +20,31 @@
using namespace lldb;
using namespace lldb_private;
-static OptionEnumValueElement g_watch_type[] = {
+static constexpr OptionEnumValueElement g_watch_type[] = {
{OptionGroupWatchpoint::eWatchRead, "read", "Watch for read"},
{OptionGroupWatchpoint::eWatchWrite, "write", "Watch for write"},
{OptionGroupWatchpoint::eWatchReadWrite, "read_write",
- "Watch for read/write"},
- {0, nullptr, nullptr}};
+ "Watch for read/write"} };
-static OptionEnumValueElement g_watch_size[] = {
+static constexpr OptionEnumValueElement g_watch_size[] = {
{1, "1", "Watch for byte size of 1"},
{2, "2", "Watch for byte size of 2"},
{4, "4", "Watch for byte size of 4"},
- {8, "8", "Watch for byte size of 8"},
- {0, nullptr, nullptr}};
+ {8, "8", "Watch for byte size of 8"} };
-static OptionDefinition g_option_table[] = {
+static constexpr OptionDefinition g_option_table[] = {
{LLDB_OPT_SET_1, false, "watch", 'w', OptionParser::eRequiredArgument,
- nullptr, g_watch_type, 0, eArgTypeWatchType,
+ nullptr, OptionEnumValues(g_watch_type), 0, eArgTypeWatchType,
"Specify the type of watching to perform."},
{LLDB_OPT_SET_1, false, "size", 's', OptionParser::eRequiredArgument,
- nullptr, g_watch_size, 0, eArgTypeByteSize,
+ nullptr, OptionEnumValues(g_watch_size), 0, eArgTypeByteSize,
"Number of bytes to use to watch a region."}};
bool OptionGroupWatchpoint::IsWatchSizeSupported(uint32_t watch_size) {
- for (uint32_t i = 0; i < llvm::array_lengthof(g_watch_size); ++i) {
- if (g_watch_size[i].value == 0)
+ for (const auto& size : g_watch_size) {
+ if (0 == size.value)
break;
- if (watch_size == g_watch_size[i].value)
+ if (watch_size == size.value)
return true;
}
return false;
OpenPOWER on IntegriCloud