[Lldb-commits] [lldb] r281569 - Make the keys enumerations for options and resolvers enum classes.
Jim Ingham via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 14 18:47:23 PDT 2016
Author: jingham
Date: Wed Sep 14 20:47:22 2016
New Revision: 281569
URL: http://llvm.org/viewvc/llvm-project?rev=281569&view=rev
Log:
Make the keys enumerations for options and resolvers enum classes.
This keeps them from conflicting with other symbols names, so it's
worth their being less convenient to use for indexing.
Modified:
lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h
lldb/trunk/source/Breakpoint/BreakpointOptions.cpp
lldb/trunk/source/Breakpoint/BreakpointResolver.cpp
Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h?rev=281569&r1=281568&r2=281569&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h Wed Sep 14 20:47:22 2016
@@ -51,17 +51,18 @@ public:
bool stop_on_error;
private:
- enum OptionNames {
+ enum class OptionNames : uint32_t {
UserSource = 0,
ScriptSource,
StopOnError,
LastOptionName
};
- static const char *g_option_names[LastOptionName];
+ static const char
+ *g_option_names[static_cast<uint32_t>(OptionNames::LastOptionName)];
static const char *GetKey(enum OptionNames enum_value) {
- return g_option_names[enum_value];
+ return g_option_names[static_cast<uint32_t>(enum_value)];
}
};
Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h?rev=281569&r1=281568&r2=281569&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointResolver.h Wed Sep 14 20:47:22 2016
@@ -202,7 +202,7 @@ protected:
// Used for serializing resolver options:
// The options in this enum and the strings in the
// g_option_names must be kept in sync.
- enum OptionNames {
+ enum class OptionNames : uint32_t {
AddressOffset = 0,
ExactMatch,
FileName,
@@ -218,11 +218,12 @@ protected:
SymbolNameArray,
LastOptionName
};
- static const char *g_option_names[LastOptionName];
+ static const char
+ *g_option_names[static_cast<uint32_t>(OptionNames::LastOptionName)];
public:
static const char *GetKey(enum OptionNames enum_value) {
- return g_option_names[enum_value];
+ return g_option_names[static_cast<uint32_t>(enum_value)];
}
protected:
Modified: lldb/trunk/source/Breakpoint/BreakpointOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointOptions.cpp?rev=281569&r1=281568&r2=281569&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointOptions.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointOptions.cpp Wed Sep 14 20:47:22 2016
@@ -28,8 +28,9 @@
using namespace lldb;
using namespace lldb_private;
-const char *BreakpointOptions::CommandData::g_option_names
- [BreakpointOptions::CommandData::OptionNames::LastOptionName]{
+const char
+ *BreakpointOptions::CommandData::g_option_names[static_cast<uint32_t>(
+ BreakpointOptions::CommandData::OptionNames::LastOptionName)]{
"UserSource", "ScriptSource", "StopOnError"};
StructuredData::ObjectSP
Modified: lldb/trunk/source/Breakpoint/BreakpointResolver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolver.cpp?rev=281569&r1=281568&r2=281569&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolver.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolver.cpp Wed Sep 14 20:47:22 2016
@@ -42,11 +42,11 @@ const char *BreakpointResolver::g_ty_to_
"SymbolName", "SourceRegex",
"Exception", "Unknown"};
-const char *BreakpointResolver::g_option_names
- [BreakpointResolver::OptionNames::LastOptionName] = {
- "AddressOffset", "Exact", "FileName", "Inlines", "Language",
- "LineNumber", "ModuleName", "NameMask", "Offset", "Regex",
- "SectionName", "SkipPrologue", "SymbolNames"};
+const char *BreakpointResolver::g_option_names[static_cast<uint32_t>(
+ BreakpointResolver::OptionNames::LastOptionName)] = {
+ "AddressOffset", "Exact", "FileName", "Inlines", "Language",
+ "LineNumber", "ModuleName", "NameMask", "Offset", "Regex",
+ "SectionName", "SkipPrologue", "SymbolNames"};
const char *BreakpointResolver::ResolverTyToName(enum ResolverTy type) {
if (type > LastKnownResolverType)
More information about the lldb-commits
mailing list