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.

llvm-svn: 281569
This commit is contained in:
Jim Ingham 2016-09-15 01:47:22 +00:00
parent a5277d59d0
commit 75f0f5830b
4 changed files with 16 additions and 13 deletions

View File

@ -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)];
}
};

View File

@ -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:

View File

@ -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

View File

@ -42,11 +42,11 @@ const char *BreakpointResolver::g_ty_to_name[] = {"FileAndLine", "Address",
"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)