Skip to content

Commit

Permalink
Format OptionEnumValueElement (NFC)
Browse files Browse the repository at this point in the history
Reformat OptionEnumValueElement to make it easier to distinguish between
its fields. This also removes the need to disable clang-format for these
arrays.

Differential revision: https://reviews.llvm.org/D65489

llvm-svn: 367638
  • Loading branch information
JDevlieghere committed Aug 2, 2019
1 parent 12961ff commit e063ecc
Show file tree
Hide file tree
Showing 11 changed files with 368 additions and 151 deletions.
33 changes: 20 additions & 13 deletions lldb/source/Commands/CommandObjectBreakpointCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,26 @@
using namespace lldb;
using namespace lldb_private;

// CommandObjectBreakpointCommandAdd

// FIXME: "script-type" needs to have its contents determined dynamically, so
// somebody can add a new scripting
// language to lldb and have it pickable here without having to change this
// enumeration by hand and rebuild lldb proper.

// somebody can add a new scripting language to lldb and have it pickable here
// without having to change this enumeration by hand and rebuild lldb proper.
static constexpr OptionEnumValueElement g_script_option_enumeration[] = {
{eScriptLanguageNone, "command",
"Commands are in the lldb command interpreter language"},
{eScriptLanguagePython, "python", "Commands are in the Python language."},
{eSortOrderByName, "default-script",
"Commands are in the default scripting language."} };
{
eScriptLanguageNone,
"command",
"Commands are in the lldb command interpreter language",
},
{
eScriptLanguagePython,
"python",
"Commands are in the Python language.",
},
{
eSortOrderByName,
"default-script",
"Commands are in the default scripting language.",
},
};

static constexpr OptionEnumValues ScriptOptionEnum() {
return OptionEnumValues(g_script_option_enumeration);
Expand Down Expand Up @@ -558,7 +565,7 @@ class CommandObjectBreakpointCommandDelete : public CommandObjectParsed {

BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
command, target, result, &valid_bp_ids,
command, target, result, &valid_bp_ids,
BreakpointName::Permissions::PermissionKinds::listPerm);

if (result.Succeeded()) {
Expand Down Expand Up @@ -648,7 +655,7 @@ class CommandObjectBreakpointCommandList : public CommandObjectParsed {

BreakpointIDList valid_bp_ids;
CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
command, target, result, &valid_bp_ids,
command, target, result, &valid_bp_ids,
BreakpointName::Permissions::PermissionKinds::listPerm);

if (result.Succeeded()) {
Expand Down
22 changes: 16 additions & 6 deletions lldb/source/Commands/CommandObjectCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1486,12 +1486,22 @@ class CommandObjectCommandsScriptImport : public CommandObjectParsed {

// CommandObjectCommandsScriptAdd
static constexpr OptionEnumValueElement g_script_synchro_type[] = {
{eScriptedCommandSynchronicitySynchronous, "synchronous",
"Run synchronous"},
{eScriptedCommandSynchronicityAsynchronous, "asynchronous",
"Run asynchronous"},
{eScriptedCommandSynchronicityCurrentValue, "current",
"Do not alter current setting"} };
{
eScriptedCommandSynchronicitySynchronous,
"synchronous",
"Run synchronous",
},
{
eScriptedCommandSynchronicityAsynchronous,
"asynchronous",
"Run asynchronous",
},
{
eScriptedCommandSynchronicityCurrentValue,
"current",
"Do not alter current setting",
},
};

static constexpr OptionEnumValues ScriptSynchroType() {
return OptionEnumValues(g_script_synchro_type);
Expand Down
15 changes: 11 additions & 4 deletions lldb/source/Commands/CommandObjectExpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,17 @@ CommandObjectExpression::CommandOptions::CommandOptions() : OptionGroup() {}
CommandObjectExpression::CommandOptions::~CommandOptions() = default;

static constexpr OptionEnumValueElement g_description_verbosity_type[] = {
{eLanguageRuntimeDescriptionDisplayVerbosityCompact, "compact",
"Only show the description string"},
{eLanguageRuntimeDescriptionDisplayVerbosityFull, "full",
"Show the full output, including persistent variable's name and type"} };
{
eLanguageRuntimeDescriptionDisplayVerbosityCompact,
"compact",
"Only show the description string",
},
{
eLanguageRuntimeDescriptionDisplayVerbosityFull,
"full",
"Show the full output, including persistent variable's name and type",
},
};

static constexpr OptionEnumValues DescriptionVerbosityTypes() {
return OptionEnumValues(g_description_verbosity_type);
Expand Down
44 changes: 33 additions & 11 deletions lldb/source/Commands/CommandObjectTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,24 @@ static uint32_t DumpTargetList(TargetList &target_list,
}

// Note that the negation in the argument name causes a slightly confusing
// mapping of the enum values,
// mapping of the enum values.
static constexpr OptionEnumValueElement g_dependents_enumaration[] = {
{eLoadDependentsDefault, "default",
"Only load dependents when the target is an executable."},
{eLoadDependentsNo, "true",
"Don't load dependents, even if the target is an executable."},
{eLoadDependentsYes, "false",
"Load dependents, even if the target is not an executable."}};
{
eLoadDependentsDefault,
"default",
"Only load dependents when the target is an executable.",
},
{
eLoadDependentsNo,
"true",
"Don't load dependents, even if the target is an executable.",
},
{
eLoadDependentsYes,
"false",
"Load dependents, even if the target is not an executable.",
},
};

#define LLDB_OPTIONS_target_dependents
#include "CommandOptions.inc"
Expand Down Expand Up @@ -1959,10 +1969,22 @@ class CommandObjectTargetModulesDumpObjfile
#pragma mark CommandObjectTargetModulesDumpSymtab

static constexpr OptionEnumValueElement g_sort_option_enumeration[] = {
{eSortOrderNone, "none",
"No sorting, use the original symbol table order."},
{eSortOrderByAddress, "address", "Sort output by symbol address."},
{eSortOrderByName, "name", "Sort output by symbol name."} };
{
eSortOrderNone,
"none",
"No sorting, use the original symbol table order.",
},
{
eSortOrderByAddress,
"address",
"Sort output by symbol address.",
},
{
eSortOrderByName,
"name",
"Sort output by symbol name.",
},
};

#define LLDB_OPTIONS_target_modules_dump_symtab
#include "CommandOptions.inc"
Expand Down
29 changes: 18 additions & 11 deletions lldb/source/Commands/CommandObjectWatchpointCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,26 @@
using namespace lldb;
using namespace lldb_private;

// CommandObjectWatchpointCommandAdd

// FIXME: "script-type" needs to have its contents determined dynamically, so
// somebody can add a new scripting
// language to lldb and have it pickable here without having to change this
// enumeration by hand and rebuild lldb proper.

// somebody can add a new scripting language to lldb and have it pickable here
// without having to change this enumeration by hand and rebuild lldb proper.
static constexpr OptionEnumValueElement g_script_option_enumeration[] = {
{eScriptLanguageNone, "command",
"Commands are in the lldb command interpreter language"},
{eScriptLanguagePython, "python", "Commands are in the Python language."},
{eSortOrderByName, "default-script",
"Commands are in the default scripting language."} };
{
eScriptLanguageNone,
"command",
"Commands are in the lldb command interpreter language",
},
{
eScriptLanguagePython,
"python",
"Commands are in the Python language.",
},
{
eSortOrderByName,
"default-script",
"Commands are in the default scripting language.",
},
};

static constexpr OptionEnumValues ScriptOptionEnum() {
return OptionEnumValues(g_script_option_enumeration);
Expand Down
102 changes: 71 additions & 31 deletions lldb/source/Core/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,47 @@ static DebuggerList *g_debugger_list_ptr =
nullptr; // NOTE: intentional leak to avoid issues with C++ destructor chain

static constexpr OptionEnumValueElement g_show_disassembly_enum_values[] = {
{Debugger::eStopDisassemblyTypeNever, "never",
"Never show disassembly when displaying a stop context."},
{Debugger::eStopDisassemblyTypeNoDebugInfo, "no-debuginfo",
"Show disassembly when there is no debug information."},
{Debugger::eStopDisassemblyTypeNoSource, "no-source",
"Show disassembly when there is no source information, or the source file "
"is missing when displaying a stop context."},
{Debugger::eStopDisassemblyTypeAlways, "always",
"Always show disassembly when displaying a stop context."} };
{
Debugger::eStopDisassemblyTypeNever,
"never",
"Never show disassembly when displaying a stop context.",
},
{
Debugger::eStopDisassemblyTypeNoDebugInfo,
"no-debuginfo",
"Show disassembly when there is no debug information.",
},
{
Debugger::eStopDisassemblyTypeNoSource,
"no-source",
"Show disassembly when there is no source information, or the source "
"file "
"is missing when displaying a stop context.",
},
{
Debugger::eStopDisassemblyTypeAlways,
"always",
"Always show disassembly when displaying a stop context.",
},
};

static constexpr OptionEnumValueElement g_language_enumerators[] = {
{eScriptLanguageNone, "none", "Disable scripting languages."},
{eScriptLanguagePython, "python",
"Select python as the default scripting language."},
{eScriptLanguageDefault, "default",
"Select the lldb default as the default scripting language."} };
{
eScriptLanguageNone,
"none",
"Disable scripting languages.",
},
{
eScriptLanguagePython,
"python",
"Select python as the default scripting language.",
},
{
eScriptLanguageDefault,
"default",
"Select the lldb default as the default scripting language.",
},
};

#define MODULE_WITH_FUNC \
"{ " \
Expand Down Expand Up @@ -189,18 +214,32 @@ static constexpr OptionEnumValueElement g_language_enumerators[] = {
// without-args}}:\n}{${current-pc-arrow} }{${addr-file-or-load}}:

static constexpr OptionEnumValueElement s_stop_show_column_values[] = {
{eStopShowColumnAnsiOrCaret, "ansi-or-caret",
"Highlight the stop column with ANSI terminal codes when color/ANSI mode "
"is enabled; otherwise, fall back to using a text-only caret (^) as if "
"\"caret-only\" mode was selected."},
{eStopShowColumnAnsi, "ansi", "Highlight the stop column with ANSI "
"terminal codes when running LLDB with "
"color/ANSI enabled."},
{eStopShowColumnCaret, "caret",
"Highlight the stop column with a caret character (^) underneath the stop "
"column. This method introduces a new line in source listings that "
"display thread stop locations."},
{eStopShowColumnNone, "none", "Do not highlight the stop column."}};
{
eStopShowColumnAnsiOrCaret,
"ansi-or-caret",
"Highlight the stop column with ANSI terminal codes when color/ANSI "
"mode is enabled; otherwise, fall back to using a text-only caret (^) "
"as if \"caret-only\" mode was selected.",
},
{
eStopShowColumnAnsi,
"ansi",
"Highlight the stop column with ANSI terminal codes when running LLDB "
"with color/ANSI enabled.",
},
{
eStopShowColumnCaret,
"caret",
"Highlight the stop column with a caret character (^) underneath the "
"stop column. This method introduces a new line in source listings "
"that display thread stop locations.",
},
{
eStopShowColumnNone,
"none",
"Do not highlight the stop column.",
},
};

#define LLDB_PROPERTIES_debugger
#include "CoreProperties.inc"
Expand All @@ -216,7 +255,8 @@ Status Debugger::SetPropertyValue(const ExecutionContext *exe_ctx,
VarSetOperationType op,
llvm::StringRef property_path,
llvm::StringRef value) {
bool is_load_script = (property_path == "target.load-script-from-symbol-file");
bool is_load_script =
(property_path == "target.load-script-from-symbol-file");
bool is_escape_non_printables = (property_path == "escape-non-printables");
TargetSP target_sp;
LoadScriptFromSymFile load_script_old_value;
Expand Down Expand Up @@ -609,8 +649,7 @@ void Debugger::Destroy(DebuggerSP &debugger_sp) {
}
}

DebuggerSP
Debugger::FindDebuggerWithInstanceName(ConstString instance_name) {
DebuggerSP Debugger::FindDebuggerWithInstanceName(ConstString instance_name) {
DebuggerSP debugger_sp;
if (g_debugger_list_ptr && g_debugger_list_mutex_ptr) {
std::lock_guard<std::recursive_mutex> guard(*g_debugger_list_mutex_ptr);
Expand Down Expand Up @@ -1487,8 +1526,9 @@ bool Debugger::StartEventHandlerThread() {
eBroadcastBitEventThreadIsListening);

auto thread_name =
full_name.GetLength() < llvm::get_max_thread_name_length() ?
full_name.AsCString() : "dbg.evt-handler";
full_name.GetLength() < llvm::get_max_thread_name_length()
? full_name.AsCString()
: "dbg.evt-handler";

// Use larger 8MB stack for this thread
llvm::Expected<HostThread> event_handler_thread =
Expand Down
45 changes: 37 additions & 8 deletions lldb/source/Interpreter/OptionGroupWatchpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,45 @@ using namespace lldb;
using namespace lldb_private;

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"} };
{
OptionGroupWatchpoint::eWatchRead,
"read",
"Watch for read",
},
{
OptionGroupWatchpoint::eWatchWrite,
"write",
"Watch for write",
},
{
OptionGroupWatchpoint::eWatchReadWrite,
"read_write",
"Watch for read/write",
},
};

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"} };
{
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",
},
};

static constexpr OptionDefinition g_option_table[] = {
{LLDB_OPT_SET_1, false, "watch", 'w', OptionParser::eRequiredArgument,
Expand Down

0 comments on commit e063ecc

Please sign in to comment.