summaryrefslogtreecommitdiff
path: root/source/Interpreter/OptionGroupWatchpoint.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-01-19 10:06:29 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-01-19 10:06:29 +0000
commit94994d372d014ce4c8758b9605d63fae651bd8aa (patch)
tree51c0b708bd59f205d6b35cb2a8c24d62f0c33d77 /source/Interpreter/OptionGroupWatchpoint.cpp
parent39be7ce23363d12ae3e49aeb1fdb2bfeb892e836 (diff)
Notes
Diffstat (limited to 'source/Interpreter/OptionGroupWatchpoint.cpp')
-rw-r--r--source/Interpreter/OptionGroupWatchpoint.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/source/Interpreter/OptionGroupWatchpoint.cpp b/source/Interpreter/OptionGroupWatchpoint.cpp
index 0431fefaa7f9..36b4cc5ac4f6 100644
--- a/source/Interpreter/OptionGroupWatchpoint.cpp
+++ b/source/Interpreter/OptionGroupWatchpoint.cpp
@@ -9,10 +9,6 @@
#include "lldb/Interpreter/OptionGroupWatchpoint.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
-// Project includes
#include "lldb/Host/OptionParser.h"
#include "lldb/Interpreter/OptionArgParser.h"
#include "lldb/lldb-enumerations.h"
@@ -20,33 +16,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;