summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2018-04-30 16:49:04 +0000
committerAdrian Prantl <aprantl@apple.com>2018-04-30 16:49:04 +0000
commit05097246f352eca76207c9ebb08656c88bdf751a (patch)
treebfc4ec8250a939aaf4ade6fc6c528726183e5367 /lldb/source/Interpreter
parentadd59c052dd6768fd54431e6a3bf045e7f25cb59 (diff)
downloadbcm5719-llvm-05097246f352eca76207c9ebb08656c88bdf751a.tar.gz
bcm5719-llvm-05097246f352eca76207c9ebb08656c88bdf751a.zip
Reflow paragraphs in comments.
This is intended as a clean up after the big clang-format commit (r280751), which unfortunately resulted in many of the comment paragraphs in LLDB being very hard to read. FYI, the script I used was: import textwrap import commands import os import sys import re tmp = "%s.tmp"%sys.argv[1] out = open(tmp, "w+") with open(sys.argv[1], "r") as f: header = "" text = "" comment = re.compile(r'^( *//) ([^ ].*)$') special = re.compile(r'^((([A-Z]+[: ])|([0-9]+ )).*)|(.*;)$') for line in f: match = comment.match(line) if match and not special.match(match.group(2)): # skip intentionally short comments. if not text and len(match.group(2)) < 40: out.write(line) continue if text: text += " " + match.group(2) else: header = match.group(1) text = match.group(2) continue if text: filled = textwrap.wrap(text, width=(78-len(header)), break_long_words=False) for l in filled: out.write(header+" "+l+'\n') text = "" out.write(line) os.rename(tmp, sys.argv[1]) Differential Revision: https://reviews.llvm.org/D46144 llvm-svn: 331197
Diffstat (limited to 'lldb/source/Interpreter')
-rw-r--r--lldb/source/Interpreter/CommandAlias.cpp7
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp189
-rw-r--r--lldb/source/Interpreter/CommandObject.cpp49
-rw-r--r--lldb/source/Interpreter/CommandObjectRegexCommand.cpp4
-rw-r--r--lldb/source/Interpreter/CommandReturnObject.cpp8
-rw-r--r--lldb/source/Interpreter/OptionArgParser.cpp6
-rw-r--r--lldb/source/Interpreter/OptionGroupBoolean.cpp4
-rw-r--r--lldb/source/Interpreter/OptionGroupFormat.cpp21
-rw-r--r--lldb/source/Interpreter/OptionGroupVariable.cpp8
-rw-r--r--lldb/source/Interpreter/OptionValue.cpp9
-rw-r--r--lldb/source/Interpreter/OptionValueDictionary.cpp8
-rw-r--r--lldb/source/Interpreter/OptionValueFileSpec.cpp11
-rw-r--r--lldb/source/Interpreter/OptionValueFormatEntity.cpp10
-rw-r--r--lldb/source/Interpreter/OptionValueProperties.cpp31
-rw-r--r--lldb/source/Interpreter/OptionValueSInt64.cpp3
-rw-r--r--lldb/source/Interpreter/Options.cpp130
-rw-r--r--lldb/source/Interpreter/Property.cpp43
17 files changed, 238 insertions, 303 deletions
diff --git a/lldb/source/Interpreter/CommandAlias.cpp b/lldb/source/Interpreter/CommandAlias.cpp
index e785f22cce2..7a62e285608 100644
--- a/lldb/source/Interpreter/CommandAlias.cpp
+++ b/lldb/source/Interpreter/CommandAlias.cpp
@@ -196,8 +196,8 @@ bool CommandAlias::IsDashDashCommand() {
}
}
- // if this is a nested alias, it may be adding arguments on top of an
- // already dash-dash alias
+ // if this is a nested alias, it may be adding arguments on top of an already
+ // dash-dash alias
if ((m_is_dashdash_alias == eLazyBoolNo) && IsNestedAlias())
m_is_dashdash_alias =
(GetUnderlyingCommand()->IsDashDashCommand() ? eLazyBoolYes
@@ -228,8 +228,7 @@ std::pair<lldb::CommandObjectSP, OptionArgVectorSP> CommandAlias::Desugar() {
}
// allow CommandAlias objects to provide their own help, but fallback to the
-// info
-// for the underlying command if no customization has been provided
+// info for the underlying command if no customization has been provided
void CommandAlias::SetHelp(llvm::StringRef str) {
this->CommandObject::SetHelp(str);
m_did_set_help = true;
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index ef56a4787fd..eb1d6af5539 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -681,10 +681,9 @@ void CommandInterpreter::LoadCommandDictionary() {
"bt [<digit> | all]", 2, 0, false));
if (bt_regex_cmd_ap.get()) {
// accept but don't document "bt -c <number>" -- before bt was a regex
- // command if you wanted to backtrace
- // three frames you would do "bt -c 3" but the intention is to have this
- // emulate the gdb "bt" command and
- // so now "bt 3" is the preferred form, in line with gdb.
+ // command if you wanted to backtrace three frames you would do "bt -c 3"
+ // but the intention is to have this emulate the gdb "bt" command and so
+ // now "bt 3" is the preferred form, in line with gdb.
if (bt_regex_cmd_ap->AddRegexCommand("^([[:digit:]]+)$",
"thread backtrace -c %1") &&
bt_regex_cmd_ap->AddRegexCommand("^-c ([[:digit:]]+)$",
@@ -825,9 +824,8 @@ CommandObjectSP CommandInterpreter::GetCommandSP(llvm::StringRef cmd_str,
unsigned int num_user_matches = 0;
// Look through the command dictionaries one by one, and if we get only one
- // match from any of
- // them in toto, then return that, otherwise return an empty CommandObjectSP
- // and the list of matches.
+ // match from any of them in toto, then return that, otherwise return an
+ // empty CommandObjectSP and the list of matches.
if (HasCommands()) {
num_cmd_matches =
@@ -953,10 +951,9 @@ CommandObjectSP CommandInterpreter::GetCommandSPExact(llvm::StringRef cmd_str,
CommandObjectSP cmd_obj_sp = GetCommandSP(llvm::StringRef(cmd_words.GetArgumentAtIndex(0)),
include_aliases, true, nullptr);
if (cmd_obj_sp.get() != nullptr) {
- // Loop through the rest of the words in the command (everything passed in
- // was supposed to be part of a
- // command name), and find the appropriate sub-command SP for each command
- // word....
+ // Loop through the rest of the words in the command (everything passed
+ // in was supposed to be part of a command name), and find the
+ // appropriate sub-command SP for each command word....
size_t end = cmd_words.GetArgumentCount();
for (size_t j = 1; j < end; ++j) {
if (cmd_obj_sp->IsMultiwordObject()) {
@@ -986,8 +983,7 @@ CommandObject *CommandInterpreter::GetCommandObject(llvm::StringRef cmd_str,
GetCommandSP(cmd_str, false, true, matches).get();
// If we didn't find an exact match to the command string in the commands,
- // look in
- // the aliases.
+ // look in the aliases.
if (command_obj)
return command_obj;
@@ -1002,8 +998,7 @@ CommandObject *CommandInterpreter::GetCommandObject(llvm::StringRef cmd_str,
command_obj = GetCommandSP(cmd_str, false, false, nullptr).get();
// Finally, if there wasn't an inexact match among the commands, look for an
- // inexact
- // match in both the commands and aliases.
+ // inexact match in both the commands and aliases.
if (command_obj) {
if (matches)
@@ -1166,8 +1161,8 @@ void CommandInterpreter::GetHelp(CommandReturnObject &result,
CommandObject *CommandInterpreter::GetCommandObjectForCommand(
llvm::StringRef &command_string) {
// This function finds the final, lowest-level, alias-resolved command object
- // whose 'Execute' function will
- // eventually be invoked by the given command line.
+ // whose 'Execute' function will eventually be invoked by the given command
+ // line.
CommandObject *cmd_obj = nullptr;
size_t start = command_string.find_first_not_of(k_white_space);
@@ -1238,8 +1233,8 @@ static size_t FindArgumentTerminator(const std::string &s) {
break;
if (pos > 0) {
if (isspace(s[pos - 1])) {
- // Check if the string ends "\s--" (where \s is a space character)
- // or if we have "\s--\s".
+ // Check if the string ends "\s--" (where \s is a space character) or
+ // if we have "\s--\s".
if ((pos + 2 >= s_len) || isspace(s[pos + 2])) {
return pos;
}
@@ -1374,20 +1369,19 @@ CommandObject *CommandInterpreter::BuildAliasResult(
}
Status CommandInterpreter::PreprocessCommand(std::string &command) {
- // The command preprocessor needs to do things to the command
- // line before any parsing of arguments or anything else is done.
- // The only current stuff that gets preprocessed is anything enclosed
- // in backtick ('`') characters is evaluated as an expression and
- // the result of the expression must be a scalar that can be substituted
- // into the command. An example would be:
+ // The command preprocessor needs to do things to the command line before any
+ // parsing of arguments or anything else is done. The only current stuff that
+ // gets preprocessed is anything enclosed in backtick ('`') characters is
+ // evaluated as an expression and the result of the expression must be a
+ // scalar that can be substituted into the command. An example would be:
// (lldb) memory read `$rsp + 20`
Status error; // Status for any expressions that might not evaluate
size_t start_backtick;
size_t pos = 0;
while ((start_backtick = command.find('`', pos)) != std::string::npos) {
if (start_backtick > 0 && command[start_backtick - 1] == '\\') {
- // The backtick was preceded by a '\' character, remove the slash
- // and don't treat the backtick as the start of an expression
+ // The backtick was preceded by a '\' character, remove the slash and
+ // don't treat the backtick as the start of an expression
command.erase(start_backtick - 1, 1);
// No need to add one to start_backtick since we just deleted a char
pos = start_backtick;
@@ -1406,8 +1400,8 @@ Status CommandInterpreter::PreprocessCommand(std::string &command) {
ExecutionContext exe_ctx(GetExecutionContext());
Target *target = exe_ctx.GetTargetPtr();
// Get a dummy target to allow for calculator mode while processing
- // backticks.
- // This also helps break the infinite loop caused when target is null.
+ // backticks. This also helps break the infinite loop caused when
+ // target is null.
if (!target)
target = m_debugger.GetDummyTarget();
if (target) {
@@ -1559,8 +1553,8 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
const char *k_space_characters = "\t\n\v\f\r ";
size_t non_space = command_string.find_first_not_of(k_space_characters);
- // Check for empty line or comment line (lines whose first
- // non-space character is the comment character for this interpreter)
+ // Check for empty line or comment line (lines whose first non-space
+ // character is the comment character for this interpreter)
if (non_space == std::string::npos)
empty_command = true;
else if (command_string[non_space] == m_comment_char)
@@ -1633,8 +1627,8 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
CommandObject *cmd_obj = ResolveCommandImpl(command_string, result);
// Although the user may have abbreviated the command, the command_string now
- // has the command expanded to the full name. For example, if the input
- // was "br s -n main", command_string is now "breakpoint set -n main".
+ // has the command expanded to the full name. For example, if the input was
+ // "br s -n main", command_string is now "breakpoint set -n main".
if (log) {
llvm::StringRef command_name = cmd_obj ? cmd_obj->GetCommandName() : "<not found>";
log->Printf("HandleCommand, cmd_obj : '%s'", command_name.str().c_str());
@@ -1648,8 +1642,8 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
// Phase 2.
// Take care of things like setting up the history command & calling the
- // appropriate Execute method on the
- // CommandObject, with the appropriate arguments.
+ // appropriate Execute method on the CommandObject, with the appropriate
+ // arguments.
if (cmd_obj != nullptr) {
if (add_to_history) {
@@ -1759,9 +1753,8 @@ int CommandInterpreter::HandleCompletionMatches(
if (cursor_index > 0 || look_for_subcommand) {
// We are completing further on into a commands arguments, so find the
- // command and tell it
- // to complete the command.
- // First see if there is a matching initial command:
+ // command and tell it to complete the command. First see if there is a
+ // matching initial command:
CommandObject *command_object =
GetCommandObject(parsed_line.GetArgumentAtIndex(0));
if (command_object == nullptr) {
@@ -1781,17 +1774,16 @@ int CommandInterpreter::HandleCompletionMatches(
int CommandInterpreter::HandleCompletion(
const char *current_line, const char *cursor, const char *last_char,
int match_start_point, int max_return_elements, StringList &matches) {
- // We parse the argument up to the cursor, so the last argument in parsed_line
- // is
- // the one containing the cursor, and the cursor is after the last character.
+ // We parse the argument up to the cursor, so the last argument in
+ // parsed_line is the one containing the cursor, and the cursor is after the
+ // last character.
Args parsed_line(llvm::StringRef(current_line, last_char - current_line));
Args partial_parsed_line(
llvm::StringRef(current_line, cursor - current_line));
// Don't complete comments, and if the line we are completing is just the
- // history repeat character,
- // substitute the appropriate history line.
+ // history repeat character, substitute the appropriate history line.
const char *first_arg = parsed_line.GetArgumentAtIndex(0);
if (first_arg) {
if (first_arg[0] == m_comment_char)
@@ -1818,12 +1810,9 @@ int CommandInterpreter::HandleCompletion(
if (cursor > current_line && cursor[-1] == ' ') {
// We are just after a space. If we are in an argument, then we will
- // continue
- // parsing, but if we are between arguments, then we have to complete
- // whatever the next
- // element would be.
- // We can distinguish the two cases because if we are in an argument (e.g.
- // because the space is
+ // continue parsing, but if we are between arguments, then we have to
+ // complete whatever the next element would be. We can distinguish the two
+ // cases because if we are in an argument (e.g. because the space is
// protected by a quote) then the space will also be in the parsed
// argument...
@@ -1857,8 +1846,7 @@ int CommandInterpreter::HandleCompletion(
matches.InsertStringAtIndex(0, "");
} else {
// Now figure out if there is a common substring, and if so put that in
- // element 0, otherwise
- // put an empty string in element 0.
+ // element 0, otherwise put an empty string in element 0.
std::string command_partial_str;
if (cursor_index >= 0)
command_partial_str =
@@ -1869,9 +1857,8 @@ int CommandInterpreter::HandleCompletion(
const size_t partial_name_len = command_partial_str.size();
common_prefix.erase(0, partial_name_len);
- // If we matched a unique single command, add a space...
- // Only do this if the completer told us this was a complete word,
- // however...
+ // If we matched a unique single command, add a space... Only do this if
+ // the completer told us this was a complete word, however...
if (num_command_matches == 1 && word_complete) {
char quote_char = parsed_line[cursor_index].quote;
common_prefix =
@@ -1949,8 +1936,8 @@ void CommandInterpreter::BuildAliasCommandArgs(CommandObject *alias_cmd_obj,
if (option_arg_vector_sp.get()) {
if (wants_raw_input) {
// We have a command that both has command options and takes raw input.
- // Make *sure* it has a
- // " -- " in the right place in the raw_input_string.
+ // Make *sure* it has a " -- " in the right place in the
+ // raw_input_string.
size_t pos = raw_input_string.find(" -- ");
if (pos == std::string::npos) {
// None found; assume it goes at the beginning of the raw input string
@@ -2034,10 +2021,9 @@ void CommandInterpreter::BuildAliasCommandArgs(CommandObject *alias_cmd_obj,
} else {
result.SetStatus(eReturnStatusSuccessFinishNoResult);
// This alias was not created with any options; nothing further needs to be
- // done, unless it is a command that
- // wants raw input, in which case we need to clear the rest of the data from
- // cmd_args, since its in the raw
- // input string.
+ // done, unless it is a command that wants raw input, in which case we need
+ // to clear the rest of the data from cmd_args, since its in the raw input
+ // string.
if (wants_raw_input) {
cmd_args.Clear();
cmd_args.SetArguments(new_args.GetArgumentCount(),
@@ -2067,7 +2053,8 @@ int CommandInterpreter::GetOptionArgumentPosition(const char *in_string) {
while (isdigit(cptr[0]))
++cptr;
- // We've gotten to the end of the digits; are we at the end of the string?
+ // We've gotten to the end of the digits; are we at the end of the
+ // string?
if (cptr[0] == '\0')
position = atoi(start);
}
@@ -2119,12 +2106,12 @@ void CommandInterpreter::SourceInitFile(bool in_cwd,
}
}
} else {
- // If we aren't looking in the current working directory we are looking
- // in the home directory. We will first see if there is an application
- // specific ".lldbinit" file whose name is "~/.lldbinit" followed by a
- // "-" and the name of the program. If this file doesn't exist, we fall
- // back to just the "~/.lldbinit" file. We also obey any requests to not
- // load the init files.
+ // If we aren't looking in the current working directory we are looking in
+ // the home directory. We will first see if there is an application
+ // specific ".lldbinit" file whose name is "~/.lldbinit" followed by a "-"
+ // and the name of the program. If this file doesn't exist, we fall back to
+ // just the "~/.lldbinit" file. We also obey any requests to not load the
+ // init files.
llvm::SmallString<64> home_dir_path;
llvm::sys::path::home_directory(home_dir_path);
FileSpec profilePath(home_dir_path.c_str(), false);
@@ -2150,8 +2137,7 @@ void CommandInterpreter::SourceInitFile(bool in_cwd,
}
// If the file exists, tell HandleCommand to 'source' it; this will do the
- // actual broadcasting
- // of the commands back to any appropriate listener (see
+ // actual broadcasting of the commands back to any appropriate listener (see
// CommandObjectSource::Execute for more details).
if (init_file.Exists()) {
@@ -2197,15 +2183,14 @@ void CommandInterpreter::HandleCommands(const StringList &commands,
size_t num_lines = commands.GetSize();
// If we are going to continue past a "continue" then we need to run the
- // commands synchronously.
- // Make sure you reset this value anywhere you return from the function.
+ // commands synchronously. Make sure you reset this value anywhere you return
+ // from the function.
bool old_async_execution = m_debugger.GetAsyncExecution();
// If we've been given an execution context, set it at the start, but don't
- // keep resetting it or we will
- // cause series of commands that change the context, then do an operation that
- // relies on that context to fail.
+ // keep resetting it or we will cause series of commands that change the
+ // context, then do an operation that relies on that context to fail.
if (override_context != nullptr)
UpdateExecutionContext(override_context);
@@ -2230,9 +2215,8 @@ void CommandInterpreter::HandleCommands(const StringList &commands,
// HandleCommand() since we updated our context already.
// We might call into a regex or alias command, in which case the
- // add_to_history will get lost. This
- // m_command_source_depth dingus is the way we turn off adding to the
- // history in that case, so set it up here.
+ // add_to_history will get lost. This m_command_source_depth dingus is the
+ // way we turn off adding to the history in that case, so set it up here.
if (!options.GetAddToHistory())
m_command_source_depth++;
bool success =
@@ -2273,18 +2257,17 @@ void CommandInterpreter::HandleCommands(const StringList &commands,
if (result.GetImmediateErrorStream())
result.GetImmediateErrorStream()->Flush();
- // N.B. Can't depend on DidChangeProcessState, because the state coming into
- // the command execution
- // could be running (for instance in Breakpoint Commands.
- // So we check the return value to see if it is has running in it.
+ // N.B. Can't depend on DidChangeProcessState, because the state coming
+ // into the command execution could be running (for instance in Breakpoint
+ // Commands. So we check the return value to see if it is has running in
+ // it.
if ((tmp_result.GetStatus() == eReturnStatusSuccessContinuingNoResult) ||
(tmp_result.GetStatus() == eReturnStatusSuccessContinuingResult)) {
if (options.GetStopOnContinue()) {
// If we caused the target to proceed, and we're going to stop in that
- // case, set the
- // status in our real result before returning. This is an error if the
- // continue was not the
- // last command in the set of commands to be run.
+ // case, set the status in our real result before returning. This is
+ // an error if the continue was not the last command in the set of
+ // commands to be run.
if (idx != num_lines - 1)
result.AppendErrorWithFormat(
"Aborting reading of commands after command #%" PRIu64
@@ -2432,8 +2415,8 @@ void CommandInterpreter::HandleCommandsFromFile(
cmd_file_path.c_str());
}
- // Used for inheriting the right settings when "command source" might have
- // nested "command source" commands
+ // Used for inheriting the right settings when "command source" might
+ // have nested "command source" commands
lldb::StreamFileSP empty_stream_sp;
m_command_source_flags.push_back(flags);
IOHandlerSP io_handler_sp(new IOHandlerEditline(
@@ -2746,18 +2729,14 @@ void CommandInterpreter::IOHandlerInputComplete(IOHandler &io_handler,
if (is_interactive == false) {
// When we are not interactive, don't execute blank lines. This will happen
// sourcing a commands file. We don't want blank lines to repeat the
- // previous
- // command and cause any errors to occur (like redefining an alias, get an
- // error
- // and stop parsing the commands file).
+ // previous command and cause any errors to occur (like redefining an
+ // alias, get an error and stop parsing the commands file).
if (line.empty())
return;
// When using a non-interactive file handle (like when sourcing commands
- // from a file)
- // we need to echo the command out so we don't just see the command output
- // and no
- // command...
+ // from a file) we need to echo the command out so we don't just see the
+ // command output and no command...
if (io_handler.GetFlags().Test(eHandleCommandFlagEchoCommand))
io_handler.GetOutputStreamFile()->Printf("%s%s\n", io_handler.GetPrompt(),
line.c_str());
@@ -2914,13 +2893,13 @@ bool CommandInterpreter::IsActive() {
lldb::IOHandlerSP
CommandInterpreter::GetIOHandler(bool force_create,
CommandInterpreterRunOptions *options) {
- // Always re-create the IOHandlerEditline in case the input
- // changed. The old instance might have had a non-interactive
- // input and now it does or vice versa.
+ // Always re-create the IOHandlerEditline in case the input changed. The old
+ // instance might have had a non-interactive input and now it does or vice
+ // versa.
if (force_create || !m_command_io_handler_sp) {
- // Always re-create the IOHandlerEditline in case the input
- // changed. The old instance might have had a non-interactive
- // input and now it does or vice versa.
+ // Always re-create the IOHandlerEditline in case the input changed. The
+ // old instance might have had a non-interactive input and now it does or
+ // vice versa.
uint32_t flags = 0;
if (options) {
@@ -2954,8 +2933,8 @@ CommandInterpreter::GetIOHandler(bool force_create,
void CommandInterpreter::RunCommandInterpreter(
bool auto_handle_events, bool spawn_thread,
CommandInterpreterRunOptions &options) {
- // Always re-create the command interpreter when we run it in case
- // any file handles have changed.
+ // Always re-create the command interpreter when we run it in case any file
+ // handles have changed.
bool force_create = true;
m_debugger.PushIOHandler(GetIOHandler(force_create, &options));
m_stopped_for_crash = false;
@@ -3023,8 +3002,8 @@ CommandInterpreter::ResolveCommandImpl(std::string &command_line,
CommandObject *sub_cmd_obj =
cmd_obj->GetSubcommandObject(next_word.c_str());
if (sub_cmd_obj) {
- // The subcommand's name includes the parent command's name,
- // so restart rather than append to the revised_command_line.
+ // The subcommand's name includes the parent command's name, so
+ // restart rather than append to the revised_command_line.
llvm::StringRef sub_cmd_name = sub_cmd_obj->GetCommandName();
actual_cmd_name_len = sub_cmd_name.size() + 1;
revised_command_line.Clear();
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp
index f4fb5ea76d7..74b83d5445b 100644
--- a/lldb/source/Interpreter/CommandObject.cpp
+++ b/lldb/source/Interpreter/CommandObject.cpp
@@ -90,8 +90,8 @@ void CommandObject::SetHelpLong(llvm::StringRef str) { m_cmd_help_long = str; }
void CommandObject::SetSyntax(llvm::StringRef str) { m_cmd_syntax = str; }
Options *CommandObject::GetOptions() {
- // By default commands don't have options unless this virtual function
- // is overridden by base classes.
+ // By default commands don't have options unless this virtual function is
+ // overridden by base classes.
return nullptr;
}
@@ -138,10 +138,10 @@ bool CommandObject::ParseOptions(Args &args, CommandReturnObject &result) {
bool CommandObject::CheckRequirements(CommandReturnObject &result) {
#ifdef LLDB_CONFIGURATION_DEBUG
- // Nothing should be stored in m_exe_ctx between running commands as m_exe_ctx
- // has shared pointers to the target, process, thread and frame and we don't
- // want any CommandObject instances to keep any of these objects around
- // longer than for a single command. Every command should call
+ // Nothing should be stored in m_exe_ctx between running commands as
+ // m_exe_ctx has shared pointers to the target, process, thread and frame and
+ // we don't want any CommandObject instances to keep any of these objects
+ // around longer than for a single command. Every command should call
// CommandObject::Cleanup() after it has completed
assert(m_exe_ctx.GetTargetPtr() == NULL);
assert(m_exe_ctx.GetProcessPtr() == NULL);
@@ -149,9 +149,9 @@ bool CommandObject::CheckRequirements(CommandReturnObject &result) {
assert(m_exe_ctx.GetFramePtr() == NULL);
#endif
- // Lock down the interpreter's execution context prior to running the
- // command so we guarantee the selected target, process, thread and frame
- // can't go away during the execution
+ // Lock down the interpreter's execution context prior to running the command
+ // so we guarantee the selected target, process, thread and frame can't go
+ // away during the execution
m_exe_ctx = m_interpreter.GetExecutionContext();
const uint32_t flags = GetFlags().Get();
@@ -266,9 +266,8 @@ int CommandObject::HandleCompletion(Args &input, int &cursor_index,
int max_return_elements,
bool &word_complete, StringList &matches) {
// Default implementation of WantsCompletion() is !WantsRawCommandString().
- // Subclasses who want raw command string but desire, for example,
- // argument completion should override WantsCompletion() to return true,
- // instead.
+ // Subclasses who want raw command string but desire, for example, argument
+ // completion should override WantsCompletion() to return true, instead.
if (WantsRawCommandString() && !WantsCompletion()) {
// FIXME: Abstract telling the completion to insert the completion
// character.
@@ -424,9 +423,10 @@ OptSetFiltered(uint32_t opt_set_mask,
return ret_val;
}
-// Default parameter value of opt_set_mask is LLDB_OPT_SET_ALL, which means take
-// all the argument data into account. On rare cases where some argument sticks
-// with certain option sets, this function returns the option set filtered args.
+// Default parameter value of opt_set_mask is LLDB_OPT_SET_ALL, which means
+// take all the argument data into account. On rare cases where some argument
+// sticks with certain option sets, this function returns the option set
+// filtered args.
void CommandObject::GetFormattedCommandArguments(Stream &str,
uint32_t opt_set_mask) {
int num_args = m_arguments.size();
@@ -466,8 +466,7 @@ void CommandObject::GetFormattedCommandArguments(Stream &str,
first_name, second_name);
break;
// Explicitly test for all the rest of the cases, so if new types get
- // added we will notice the
- // missing case statement(s).
+ // added we will notice the missing case statement(s).
case eArgRepeatPlain:
case eArgRepeatOptional:
case eArgRepeatPlus:
@@ -503,8 +502,7 @@ void CommandObject::GetFormattedCommandArguments(Stream &str,
str.Printf("<%s_1> .. <%s_n>", name_str.c_str(), name_str.c_str());
break;
// Explicitly test for all the rest of the cases, so if new types get
- // added we will notice the
- // missing case statement(s).
+ // added we will notice the missing case statement(s).
case eArgRepeatPairPlain:
case eArgRepeatPairOptional:
case eArgRepeatPairPlus:
@@ -512,8 +510,8 @@ void CommandObject::GetFormattedCommandArguments(Stream &str,
case eArgRepeatPairRange:
case eArgRepeatPairRangeOptional:
// These should not be hit, as they should pass the IsPairType test
- // above, and control should
- // have gone into the other branch of the if statement.
+ // above, and control should have gone into the other branch of the if
+ // statement.
break;
}
}
@@ -857,9 +855,8 @@ void CommandObject::GenerateHelpText(Stream &output_strm) {
if (!IsDashDashCommand() && options && options->NumCommandOptions() > 0) {
if (WantsRawCommandString() && !WantsCompletion()) {
// Emit the message about using ' -- ' between the end of the command
- // options and the raw input
- // conditionally, i.e., only if the command object does not want
- // completion.
+ // options and the raw input conditionally, i.e., only if the command
+ // object does not want completion.
interpreter.OutputFormattedHelpText(
output_strm, "", "",
"\nImportant Note: Because this command takes 'raw' input, if you "
@@ -899,8 +896,8 @@ void CommandObject::AddIDsArgumentData(CommandArgumentEntry &arg,
id_range_arg.arg_repetition = eArgRepeatOptional;
// The first (and only) argument for this command could be either an id or an
- // id_range.
- // Push both variants into the entry for the first argument for this command.
+ // id_range. Push both variants into the entry for the first argument for
+ // this command.
arg.push_back(id_arg);
arg.push_back(id_range_arg);
}
diff --git a/lldb/source/Interpreter/CommandObjectRegexCommand.cpp b/lldb/source/Interpreter/CommandObjectRegexCommand.cpp
index 79d3bb1b5be..2bfec0b743d 100644
--- a/lldb/source/Interpreter/CommandObjectRegexCommand.cpp
+++ b/lldb/source/Interpreter/CommandObjectRegexCommand.cpp
@@ -63,8 +63,8 @@ bool CommandObjectRegexCommand::DoExecute(const char *command,
if (m_interpreter.GetExpandRegexAliases())
result.GetOutputStream().Printf("%s\n", new_command.c_str());
// Pass in true for "no context switching". The command that called us
- // should have set up the context
- // appropriately, we shouldn't have to redo that.
+ // should have set up the context appropriately, we shouldn't have to
+ // redo that.
return m_interpreter.HandleCommand(new_command.c_str(),
eLazyBoolCalculate, result, nullptr,
true, true);
diff --git a/lldb/source/Interpreter/CommandReturnObject.cpp b/lldb/source/Interpreter/CommandReturnObject.cpp
index 75c02588066..7c06e22c390 100644
--- a/lldb/source/Interpreter/CommandReturnObject.cpp
+++ b/lldb/source/Interpreter/CommandReturnObject.cpp
@@ -25,8 +25,8 @@ static void DumpStringToStreamWithNewline(Stream &strm, const std::string &s,
if (s.empty()) {
add_newline = add_newline_if_empty;
} else {
- // We already checked for empty above, now make sure there is a newline
- // in the error, and if there isn't one, add one.
+ // We already checked for empty above, now make sure there is a newline in
+ // the error, and if there isn't one, add one.
strm.Write(s.c_str(), s.size());
const char last_char = *s.rbegin();
@@ -127,8 +127,8 @@ void CommandReturnObject::SetError(llvm::StringRef error_str) {
SetStatus(eReturnStatusFailed);
}
-// Similar to AppendError, but do not prepend 'Status: ' to message, and
-// don't append "\n" to the end of it.
+// Similar to AppendError, but do not prepend 'Status: ' to message, and don't
+// append "\n" to the end of it.
void CommandReturnObject::AppendRawError(llvm::StringRef in_string) {
if (in_string.empty())
diff --git a/lldb/source/Interpreter/OptionArgParser.cpp b/lldb/source/Interpreter/OptionArgParser.cpp
index d4830df4262..3bd3af8fc50 100644
--- a/lldb/source/Interpreter/OptionArgParser.cpp
+++ b/lldb/source/Interpreter/OptionArgParser.cpp
@@ -205,9 +205,9 @@ lldb::addr_t OptionArgParser::ToAddress(const ExecutionContext *exe_ctx,
}
} else {
- // Since the compiler can't handle things like "main + 12" we should
- // try to do this for now. The compiler doesn't like adding offsets
- // to function pointer types.
+ // Since the compiler can't handle things like "main + 12" we should try to
+ // do this for now. The compiler doesn't like adding offsets to function
+ // pointer types.
static RegularExpression g_symbol_plus_offset_regex(
"^(.*)([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*$");
RegularExpression::Match regex_match(3);
diff --git a/lldb/source/Interpreter/OptionGroupBoolean.cpp b/lldb/source/Interpreter/OptionGroupBoolean.cpp
index 5fd4ce7aecf..e3759f2e60a 100644
--- a/lldb/source/Interpreter/OptionGroupBoolean.cpp
+++ b/lldb/source/Interpreter/OptionGroupBoolean.cpp
@@ -45,8 +45,8 @@ Status OptionGroupBoolean::SetOptionValue(uint32_t option_idx,
ExecutionContext *execution_context) {
Status error;
if (m_option_definition.option_has_arg == OptionParser::eNoArgument) {
- // Not argument, toggle the default value and mark the option as having been
- // set
+ // Not argument, toggle the default value and mark the option as having
+ // been set
m_value.SetCurrentValue(!m_value.GetDefaultValue());
m_value.SetOptionWasSet();
} else {
diff --git a/lldb/source/Interpreter/OptionGroupFormat.cpp b/lldb/source/Interpreter/OptionGroupFormat.cpp
index 75d8df950f1..b64c1932481 100644
--- a/lldb/source/Interpreter/OptionGroupFormat.cpp
+++ b/lldb/source/Interpreter/OptionGroupFormat.cpp
@@ -102,8 +102,8 @@ Status OptionGroupFormat::SetOptionValue(uint32_t option_idx,
// We the first character of the "gdb_format_str" is not the
// NULL terminator, we didn't consume the entire string and
- // something is wrong. Also, if none of the format, size or count
- // was specified correctly, then abort.
+ // something is wrong. Also, if none of the format, size or count was
+ // specified correctly, then abort.
if (!gdb_format_str.empty() ||
(format == eFormatInvalid && byte_size == 0 && count == 0)) {
// Nothing got set correctly
@@ -112,9 +112,8 @@ Status OptionGroupFormat::SetOptionValue(uint32_t option_idx,
return error;
}
- // At least one of the format, size or count was set correctly.
- // Anything that wasn't set correctly should be set to the
- // previous default
+ // At least one of the format, size or count was set correctly. Anything
+ // that wasn't set correctly should be set to the previous default
if (format == eFormatInvalid)
ParserGDBFormatLetter(execution_context, m_prev_gdb_format, format,
byte_size);
@@ -127,9 +126,8 @@ Status OptionGroupFormat::SetOptionValue(uint32_t option_idx,
ParserGDBFormatLetter(execution_context, m_prev_gdb_size, format,
byte_size);
} else {
- // Byte size is disabled, make sure it wasn't specified
- // but if this is an address, it's actually necessary to
- // specify one so don't error out
+ // Byte size is disabled, make sure it wasn't specified but if this is an
+ // address, it's actually necessary to specify one so don't error out
if (byte_size > 0 && format != lldb::eFormatAddressInfo) {
error.SetErrorString(
"this command doesn't support specifying a byte size");
@@ -235,10 +233,9 @@ bool OptionGroupFormat::ParserGDBFormatLetter(
case 'w':
case 'g':
{
- // Size isn't used for printing instructions, so if a size is specified, and
- // the previous format was
- // 'i', then we should reset it to the default ('x'). Otherwise we'll
- // continue to print as instructions,
+ // Size isn't used for printing instructions, so if a size is specified,
+ // and the previous format was 'i', then we should reset it to the
+ // default ('x'). Otherwise we'll continue to print as instructions,
// which isn't expected.
if (format_letter == 'b')
byte_size = 1;
diff --git a/lldb/source/Interpreter/OptionGroupVariable.cpp b/lldb/source/Interpreter/OptionGroupVariable.cpp
index 0793d373144..7b7a62be874 100644
--- a/lldb/source/Interpreter/OptionGroupVariable.cpp
+++ b/lldb/source/Interpreter/OptionGroupVariable.cpp
@@ -132,12 +132,12 @@ void OptionGroupVariable::OptionParsingStarting(
llvm::ArrayRef<OptionDefinition> OptionGroupVariable::GetDefinitions() {
auto result = llvm::makeArrayRef(g_variable_options);
- // Show the "--no-args", "--no-locals" and "--show-globals"
- // options if we are showing frame specific options
+ // Show the "--no-args", "--no-locals" and "--show-globals" options if we are
+ // showing frame specific options
if (include_frame_options)
return result;
- // Skip the "--no-args", "--no-locals" and "--show-globals"
- // options if we are not showing frame specific options (globals only)
+ // Skip the "--no-args", "--no-locals" and "--show-globals" options if we are
+ // not showing frame specific options (globals only)
return result.drop_front(NUM_FRAME_OPTS);
}
diff --git a/lldb/source/Interpreter/OptionValue.cpp b/lldb/source/Interpreter/OptionValue.cpp
index afcace2567c..c02ffeb1c4f 100644
--- a/lldb/source/Interpreter/OptionValue.cpp
+++ b/lldb/source/Interpreter/OptionValue.cpp
@@ -20,9 +20,8 @@ using namespace lldb;
using namespace lldb_private;
//-------------------------------------------------------------------------
-// Get this value as a uint64_t value if it is encoded as a boolean,
-// uint64_t or int64_t. Other types will cause "fail_value" to be
-// returned
+// Get this value as a uint64_t value if it is encoded as a boolean, uint64_t
+// or int64_t. Other types will cause "fail_value" to be returned
//-------------------------------------------------------------------------
uint64_t OptionValue::GetUInt64Value(uint64_t fail_value, bool *success_ptr) {
if (success_ptr)
@@ -508,8 +507,8 @@ const char *OptionValue::GetBuiltinTypeAsCString(Type t) {
lldb::OptionValueSP OptionValue::CreateValueFromCStringForTypeMask(
const char *value_cstr, uint32_t type_mask, Status &error) {
- // If only 1 bit is set in the type mask for a dictionary or array
- // then we know how to decode a value from a cstring
+ // If only 1 bit is set in the type mask for a dictionary or array then we
+ // know how to decode a value from a cstring
lldb::OptionValueSP value_sp;
switch (type_mask) {
case 1u << eTypeArch:
diff --git a/lldb/source/Interpreter/OptionValueDictionary.cpp b/lldb/source/Interpreter/OptionValueDictionary.cpp
index 76e4012858c..2e8a8427237 100644
--- a/lldb/source/Interpreter/OptionValueDictionary.cpp
+++ b/lldb/source/Interpreter/OptionValueDictionary.cpp
@@ -128,9 +128,7 @@ Status OptionValueDictionary::SetArgs(const Args &args,
if (key.front() == '[') {
// Key name starts with '[', so the key value must be in single or
- // double quotes like:
- // ['<key>']
- // ["<key>"]
+ // double quotes like: ['<key>'] ["<key>"]
if ((key.size() > 2) && (key.back() == ']')) {
// Strip leading '[' and trailing ']'
key = key.substr(1, key.size() - 2);
@@ -286,8 +284,8 @@ OptionValueDictionary::GetValueForKey(const ConstString &key) const {
bool OptionValueDictionary::SetValueForKey(const ConstString &key,
const lldb::OptionValueSP &value_sp,
bool can_replace) {
- // Make sure the value_sp object is allowed to contain
- // values of the type passed in...
+ // Make sure the value_sp object is allowed to contain values of the type
+ // passed in...
if (value_sp && (m_type_mask & value_sp->GetTypeAsMask())) {
if (!can_replace) {
collection::const_iterator pos = m_values.find(key);
diff --git a/lldb/source/Interpreter/OptionValueFileSpec.cpp b/lldb/source/Interpreter/OptionValueFileSpec.cpp
index 9430015453b..fe654a1d1a3 100644
--- a/lldb/source/Interpreter/OptionValueFileSpec.cpp
+++ b/lldb/source/Interpreter/OptionValueFileSpec.cpp
@@ -67,13 +67,10 @@ Status OptionValueFileSpec::SetValueFromString(llvm::StringRef value,
case eVarSetOperationAssign:
if (value.size() > 0) {
// The setting value may have whitespace, double-quotes, or single-quotes
- // around the file
- // path to indicate that internal spaces are not word breaks. Strip off
- // any ws & quotes
- // from the start and end of the file path - we aren't doing any word //
- // breaking here so
- // the quoting is unnecessary. NB this will cause a problem if someone
- // tries to specify
+ // around the file path to indicate that internal spaces are not word
+ // breaks. Strip off any ws & quotes from the start and end of the file
+ // path - we aren't doing any word // breaking here so the quoting is
+ // unnecessary. NB this will cause a problem if someone tries to specify
// a file path that legitimately begins or ends with a " or ' character,
// or whitespace.
value = value.trim("\"' \t");
diff --git a/lldb/source/Interpreter/OptionValueFormatEntity.cpp b/lldb/source/Interpreter/OptionValueFormatEntity.cpp
index e9431d4562e..dc9afeac938 100644
--- a/lldb/source/Interpreter/OptionValueFormatEntity.cpp
+++ b/lldb/source/Interpreter/OptionValueFormatEntity.cpp
@@ -64,12 +64,10 @@ Status OptionValueFormatEntity::SetValueFromString(llvm::StringRef value_str,
case eVarSetOperationReplace:
case eVarSetOperationAssign: {
// Check if the string starts with a quote character after removing leading
- // and trailing spaces.
- // If it does start with a quote character, make sure it ends with the same
- // quote character
- // and remove the quotes before we parse the format string. If the string
- // doesn't start with
- // a quote, leave the string alone and parse as is.
+ // and trailing spaces. If it does start with a quote character, make sure
+ // it ends with the same quote character and remove the quotes before we
+ // parse the format string. If the string doesn't start with a quote, leave
+ // the string alone and parse as is.
llvm::StringRef trimmed_value_str = value_str.trim();
if (!trimmed_value_str.empty()) {
const char first_char = trimmed_value_str[0];
diff --git a/lldb/source/Interpreter/OptionValueProperties.cpp b/lldb/source/Interpreter/OptionValueProperties.cpp
index a41a7a96ee8..3a11028192c 100644
--- a/lldb/source/Interpreter/OptionValueProperties.cpp
+++ b/lldb/source/Interpreter/OptionValueProperties.cpp
@@ -35,15 +35,13 @@ OptionValueProperties::OptionValueProperties(
m_name(global_properties.m_name),
m_properties(global_properties.m_properties),
m_name_to_index(global_properties.m_name_to_index) {
- // We now have an exact copy of "global_properties". We need to now
- // find all non-global settings and copy the property values so that
- // all non-global settings get new OptionValue instances created for
- // them.
+ // We now have an exact copy of "global_properties". We need to now find all
+ // non-global settings and copy the property values so that all non-global
+ // settings get new OptionValue instances created for them.
const size_t num_properties = m_properties.size();
for (size_t i = 0; i < num_properties; ++i) {
// Duplicate any values that are not global when constructing properties
- // from
- // a global copy
+ // from a global copy
if (m_properties[i].IsGlobal() == false) {
lldb::OptionValueSP new_value_sp(m_properties[i].GetValue()->DeepCopy());
m_properties[i].SetOptionValue(new_value_sp);
@@ -157,15 +155,13 @@ OptionValueProperties::GetSubValue(const ExecutionContext *exe_ctx,
case '{':
// Predicate matching for predicates like
// "<setting-name>{<predicate>}"
- // strings are parsed by the current OptionValueProperties subclass
- // to mean whatever they want to. For instance a subclass of
- // OptionValueProperties for a lldb_private::Target might implement:
- // "target.run-args{arch==i386}" -- only set run args if the arch is
- // i386
- // "target.run-args{path=/tmp/a/b/c/a.out}" -- only set run args if the
- // path matches
- // "target.run-args{basename==test&&arch==x86_64}" -- only set run args
- // if executable basename is "test" and arch is "x86_64"
+ // strings are parsed by the current OptionValueProperties subclass to mean
+ // whatever they want to. For instance a subclass of OptionValueProperties
+ // for a lldb_private::Target might implement: "target.run-
+ // args{arch==i386}" -- only set run args if the arch is i386 "target
+ // .run-args{path=/tmp/a/b/c/a.out}" -- only set run args if the path
+ // matches "target.run-args{basename==test&&arch==x86_64}" -- only set run
+ // args if executable basename is "test" and arch is "x86_64"
if (sub_name[1]) {
llvm::StringRef predicate_start = sub_name.drop_front();
size_t pos = predicate_start.find_first_of('}');
@@ -189,9 +185,8 @@ OptionValueProperties::GetSubValue(const ExecutionContext *exe_ctx,
break;
case '[':
- // Array or dictionary access for subvalues like:
- // "[12]" -- access 12th array element
- // "['hello']" -- dictionary access of key named hello
+ // Array or dictionary access for subvalues like: "[12]" -- access
+ // 12th array element "['hello']" -- dictionary access of key named hello
return value_sp->GetSubValue(exe_ctx, sub_name, will_modify, error);
default:
diff --git a/lldb/source/Interpreter/OptionValueSInt64.cpp b/lldb/source/Interpreter/OptionValueSInt64.cpp
index 9dbcd58dc3e..ddd1b9662ca 100644
--- a/lldb/source/Interpreter/OptionValueSInt64.cpp
+++ b/lldb/source/Interpreter/OptionValueSInt64.cpp
@@ -21,7 +21,8 @@ using namespace lldb_private;
void OptionValueSInt64::DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
uint32_t dump_mask) {
- // printf ("%p: DumpValue (exe_ctx=%p, strm, mask) m_current_value = %" PRIi64
+ // printf ("%p: DumpValue (exe_ctx=%p, strm, mask) m_current_value = %"
+ // PRIi64
// "\n", this, exe_ctx, m_current_value);
if (dump_mask & eDumpOptionType)
strm.Printf("(%s)", GetTypeAsCString());
diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp
index 6f27abd4eeb..73ad0bcdbc3 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -115,13 +115,12 @@ bool Options::VerifyOptions(CommandReturnObject &result) {
int num_levels = GetRequiredOptions().size();
if (num_levels) {
for (int i = 0; i < num_levels && !options_are_valid; ++i) {
- // This is the correct set of options if: 1). m_seen_options contains all
- // of m_required_options[i]
- // (i.e. all the required options at this level are a subset of
- // m_seen_options); AND
- // 2). { m_seen_options - m_required_options[i] is a subset of
- // m_options_options[i] (i.e. all the rest of
- // m_seen_options are in the set of optional options at this level.
+ // This is the correct set of options if: 1). m_seen_options contains
+ // all of m_required_options[i] (i.e. all the required options at this
+ // level are a subset of m_seen_options); AND 2). { m_seen_options -
+ // m_required_options[i] is a subset of m_options_options[i] (i.e. all
+ // the rest of m_seen_options are in the set of optional options at this
+ // level.
// Check to see if all of m_required_options[i] are a subset of
// m_seen_options
@@ -152,8 +151,7 @@ bool Options::VerifyOptions(CommandReturnObject &result) {
}
// This is called in the Options constructor, though we could call it lazily if
-// that ends up being
-// a performance problem.
+// that ends up being a performance problem.
void Options::BuildValidOptionSets() {
// Check to see if we already did this.
@@ -265,13 +263,11 @@ Option *Options::GetLongOptions() {
}
// This function takes INDENT, which tells how many spaces to output at the
-// front of each line; SPACES, which is
-// a string containing 80 spaces; and TEXT, which is the text that is to be
-// output. It outputs the text, on
+// front of each line; SPACES, which is a string containing 80 spaces; and
+// TEXT, which is the text that is to be output. It outputs the text, on
// multiple lines if necessary, to RESULT, with INDENT spaces at the front of
-// each line. It breaks lines on spaces,
-// tabs or newlines, shortening the line if necessary to not break in the middle
-// of a word. It assumes that each
+// each line. It breaks lines on spaces, tabs or newlines, shortening the line
+// if necessary to not break in the middle of a word. It assumes that each
// output line should contain a maximum of OUTPUT_MAX_COLUMNS characters.
void Options::OutputFormattedUsageText(Stream &strm,
@@ -421,8 +417,8 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject *cmd,
strm.IndentMore(2);
- // First, show each usage level set of options, e.g. <cmd>
- // [options-for-level-0]
+ // First, show each usage level set of options, e.g. <cmd> [options-for-
+ // level-0]
// <cmd>
// [options-for-level-1]
// etc.
@@ -449,9 +445,9 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject *cmd,
if (cmd)
cmd->GetFormattedCommandArguments(args_str, opt_set_mask);
- // First go through and print all options that take no arguments as
- // a single string. If a command has "-a" "-b" and "-c", this will show
- // up as [-abc]
+ // First go through and print all options that take no arguments as a
+ // single string. If a command has "-a" "-b" and "-c", this will show up
+ // as [-abc]
std::set<int> options;
std::set<int>::const_iterator options_pos, options_end;
@@ -554,24 +550,23 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject *cmd,
// help text
// This variable is used to keep track of which options' info we've printed
- // out, because some options can be in
- // more than one usage level, but we only want to print the long form of its
- // information once.
+ // out, because some options can be in more than one usage level, but we
+ // only want to print the long form of its information once.
std::multimap<int, uint32_t> options_seen;
strm.IndentMore(5);
// Put the unique command options in a vector & sort it, so we can output
- // them alphabetically (by short_option)
- // when writing out detailed help for each option.
+ // them alphabetically (by short_option) when writing out detailed help for
+ // each option.
i = 0;
for (auto &def : opt_defs)
options_seen.insert(std::make_pair(def.short_option, i++));
- // Go through the unique'd and alphabetically sorted vector of options, find
- // the table entry for each option
- // and write out the detailed help information for that option.
+ // Go through the unique'd and alphabetically sorted vector of options,
+ // find the table entry for each option and write out the detailed help
+ // information for that option.
bool first_option_printed = false;
@@ -627,14 +622,10 @@ void Options::GenerateOptionUsage(Stream &strm, CommandObject *cmd,
}
// This function is called when we have been given a potentially incomplete set
-// of
-// options, such as when an alias has been defined (more options might be added
-// at
-// at the time the alias is invoked). We need to verify that the options in the
-// set
-// m_seen_options are all part of a set that may be used together, but
-// m_seen_options
-// may be missing some of the "required" options.
+// of options, such as when an alias has been defined (more options might be
+// added at at the time the alias is invoked). We need to verify that the
+// options in the set m_seen_options are all part of a set that may be used
+// together, but m_seen_options may be missing some of the "required" options.
bool Options::VerifyPartialOptions(CommandReturnObject &result) {
bool options_are_valid = false;
@@ -643,10 +634,8 @@ bool Options::VerifyPartialOptions(CommandReturnObject &result) {
if (num_levels) {
for (int i = 0; i < num_levels && !options_are_valid; ++i) {
// In this case we are treating all options as optional rather than
- // required.
- // Therefore a set of options is correct if m_seen_options is a subset of
- // the
- // union of m_required_options and m_optional_options.
+ // required. Therefore a set of options is correct if m_seen_options is a
+ // subset of the union of m_required_options and m_optional_options.
OptionSet union_set;
OptionsSetUnion(GetRequiredOptions()[i], GetOptionalOptions()[i],
union_set);
@@ -667,7 +656,8 @@ bool Options::HandleOptionCompletion(
// For now we just scan the completions to see if the cursor position is in
// an option or its argument. Otherwise we'll call HandleArgumentCompletion.
- // In the future we can use completion to validate options as well if we want.
+ // In the future we can use completion to validate options as well if we
+ // want.
auto opt_defs = GetDefinitions();
@@ -709,12 +699,10 @@ bool Options::HandleOptionCompletion(
}
return true;
} else if (opt_defs_index != OptionArgElement::eUnrecognizedArg) {
- // We recognized it, if it an incomplete long option, complete it anyway
- // (getopt_long_only is
- // happy with shortest unique string, but it's still a nice thing to
- // do.) Otherwise return
- // The string so the upper level code will know this is a full match and
- // add the " ".
+ // We recognized it, if it an incomplete long option, complete it
+ // anyway (getopt_long_only is happy with shortest unique string, but
+ // it's still a nice thing to do.) Otherwise return The string so the
+ // upper level code will know this is a full match and add the " ".
if (cur_opt_str && strlen(cur_opt_str) > 2 && cur_opt_str[0] == '-' &&
cur_opt_str[1] == '-' &&
strcmp(opt_defs[opt_defs_index].long_option, cur_opt_str) != 0) {
@@ -731,9 +719,8 @@ bool Options::HandleOptionCompletion(
// Check to see if they are writing a long option & complete it.
// I think we will only get in here if the long option table has two
// elements
- // that are not unique up to this point. getopt_long_only does shortest
- // unique match
- // for long options already.
+ // that are not unique up to this point. getopt_long_only does
+ // shortest unique match for long options already.
if (cur_opt_str && strlen(cur_opt_str) > 2 && cur_opt_str[0] == '-' &&
cur_opt_str[1] == '-') {
@@ -762,8 +749,8 @@ bool Options::HandleOptionCompletion(
}
} else if (opt_arg_pos == cursor_index) {
- // Okay the cursor is on the completion of an argument.
- // See if it has a completion, otherwise return no matches.
+ // Okay the cursor is on the completion of an argument. See if it has a
+ // completion, otherwise return no matches.
if (opt_defs_index != -1) {
HandleOptionArgumentCompletion(
@@ -813,10 +800,9 @@ bool Options::HandleOptionArgumentCompletion(
return return_value;
}
- // If this is a source file or symbol type completion, and there is a
- // -shlib option somewhere in the supplied arguments, then make a search
- // filter
- // for that shared library.
+ // If this is a source file or symbol type completion, and there is a -shlib
+ // option somewhere in the supplied arguments, then make a search filter for
+ // that shared library.
// FIXME: Do we want to also have an "OptionType" so we don't have to match
// string names?
@@ -908,8 +894,8 @@ void OptionGroupOptions::Finalize() {
Status OptionGroupOptions::SetOptionValue(uint32_t option_idx,
llvm::StringRef option_value,
ExecutionContext *execution_context) {
- // After calling OptionGroupOptions::Append(...), you must finalize the groups
- // by calling OptionGroupOptions::Finlize()
+ // After calling OptionGroupOptions::Append(...), you must finalize the
+ // groups by calling OptionGroupOptions::Finlize()
assert(m_did_finalize);
Status error;
if (option_idx < m_option_infos.size()) {
@@ -1111,8 +1097,8 @@ llvm::Expected<Args> Options::ParseAlias(const Args &args,
option_arg_vector->emplace_back(option_str.GetString(), has_arg,
option_arg);
- // Find option in the argument list; also see if it was supposed to take
- // an argument and if one was supplied. Remove option (and argument, if
+ // Find option in the argument list; also see if it was supposed to take an
+ // argument and if one was supplied. Remove option (and argument, if
// given) from the argument list. Also remove them from the
// raw_input_string, if one was passed in.
size_t idx =
@@ -1155,8 +1141,8 @@ OptionElementVector Options::ParseForCompletion(const Args &args,
if (long_options == nullptr)
return option_element_vector;
- // Leading : tells getopt to return a : for a missing option argument AND
- // to suppress error messages.
+ // Leading : tells getopt to return a : for a missing option argument AND to
+ // suppress error messages.
sstr << ":";
for (int i = 0; long_options[i].definition != nullptr; ++i) {
@@ -1339,12 +1325,11 @@ OptionElementVector Options::ParseForCompletion(const Args &args,
}
// Finally we have to handle the case where the cursor index points at a
- // single "-". We want to mark that in
- // the option_element_vector, but only if it is not after the "--". But it
- // turns out that OptionParser::Parse just ignores
- // an isolated "-". So we have to look it up by hand here. We only care if
- // it is AT the cursor position.
- // Note, a single quoted dash is not the same as a single dash...
+ // single "-". We want to mark that in the option_element_vector, but only
+ // if it is not after the "--". But it turns out that OptionParser::Parse
+ // just ignores an isolated "-". So we have to look it up by hand here. We
+ // only care if it is AT the cursor position. Note, a single quoted dash is
+ // not the same as a single dash...
const Args::ArgEntry &cursor = args[cursor_index];
if ((static_cast<int32_t>(dash_dash_pos) == -1 ||
@@ -1426,8 +1411,8 @@ llvm::Expected<Args> Options::Parse(const Args &args,
const OptionDefinition *def = long_options[long_options_index].definition;
if (!platform_sp) {
- // User did not pass in an explicit platform. Try to grab
- // from the execution context.
+ // User did not pass in an explicit platform. Try to grab from the
+ // execution context.
TargetSP target_sp =
execution_context ? execution_context->GetTargetSP() : TargetSP();
platform_sp = target_sp ? target_sp->GetPlatform() : PlatformSP();
@@ -1435,9 +1420,8 @@ llvm::Expected<Args> Options::Parse(const Args &args,
OptionValidator *validator = def->validator;
if (!platform_sp && require_validation) {
- // Caller requires validation but we cannot validate as we
- // don't have the mandatory platform against which to
- // validate.
+ // Caller requires validation but we cannot validate as we don't have
+ // the mandatory platform against which to validate.
return llvm::make_error<llvm::StringError>(
"cannot validate options: no platform available",
llvm::inconvertibleErrorCode());
diff --git a/lldb/source/Interpreter/Property.cpp b/lldb/source/Interpreter/Property.cpp
index 7e55da2f396..bef28f1bec5 100644
--- a/lldb/source/Interpreter/Property.cpp
+++ b/lldb/source/Interpreter/Property.cpp
@@ -77,8 +77,7 @@ Property::Property(const PropertyDefinition &definition)
// "definition.default_uint_value" is the default enumeration value if
// "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the
- // default
- // value.
+ // default value.
{
OptionValueEnumeration *enum_value = new OptionValueEnumeration(
definition.enum_values, definition.default_uint_value);
@@ -89,10 +88,10 @@ Property::Property(const PropertyDefinition &definition)
llvm::StringRef(definition.default_cstr_value))
.Success()) {
enum_value->SetDefaultValue(enum_value->GetCurrentValue());
- // Call Clear() since we don't want the value to appear as
- // having been set since we called SetValueFromString() above.
- // Clear will set the current value to the default and clear
- // the boolean that says that the value has been set.
+ // Call Clear() since we don't want the value to appear as having
+ // been set since we called SetValueFromString() above. Clear will
+ // set the current value to the default and clear the boolean that
+ // says that the value has been set.
enum_value->Clear();
}
}
@@ -101,8 +100,7 @@ Property::Property(const PropertyDefinition &definition)
case OptionValue::eTypeFileSpec: {
// "definition.default_uint_value" represents if the
- // "definition.default_cstr_value" should
- // be resolved or not
+ // "definition.default_cstr_value" should be resolved or not
const bool resolve = definition.default_uint_value != 0;
m_value_sp.reset(new OptionValueFileSpec(
FileSpec(definition.default_cstr_value, resolve), resolve));
@@ -117,11 +115,9 @@ Property::Property(const PropertyDefinition &definition)
case OptionValue::eTypeFormat:
// "definition.default_uint_value" is the default format enumeration value
- // if
- // "definition.default_cstr_value" is NULL, otherwise interpret
+ // if "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the
- // default
- // value.
+ // default value.
{
Format new_format = eFormatInvalid;
if (definition.default_cstr_value)
@@ -134,12 +130,10 @@ Property::Property(const PropertyDefinition &definition)
break;
case OptionValue::eTypeLanguage:
- // "definition.default_uint_value" is the default language enumeration value
- // if
- // "definition.default_cstr_value" is NULL, otherwise interpret
+ // "definition.default_uint_value" is the default language enumeration
+ // value if "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the
- // default
- // value.
+ // default value.
{
LanguageType new_lang = eLanguageTypeUnknown;
if (definition.default_cstr_value)
@@ -160,8 +154,7 @@ Property::Property(const PropertyDefinition &definition)
case OptionValue::eTypePathMap:
// "definition.default_uint_value" tells us if notifications should occur
- // for
- // path mappings
+ // for path mappings
m_value_sp.reset(
new OptionValuePathMappings(definition.default_uint_value != 0));
break;
@@ -177,8 +170,7 @@ Property::Property(const PropertyDefinition &definition)
// "definition.default_uint_value" is the default integer value if
// "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the
- // default
- // value.
+ // default value.
m_value_sp.reset(new OptionValueSInt64(
definition.default_cstr_value
? StringConvert::ToSInt64(definition.default_cstr_value)
@@ -189,8 +181,7 @@ Property::Property(const PropertyDefinition &definition)
// "definition.default_uint_value" is the default unsigned integer value if
// "definition.default_cstr_value" is NULL, otherwise interpret
// "definition.default_cstr_value" as a string value that represents the
- // default
- // value.
+ // default value.
m_value_sp.reset(new OptionValueUInt64(
definition.default_cstr_value
? StringConvert::ToUInt64(definition.default_cstr_value)
@@ -209,9 +200,9 @@ Property::Property(const PropertyDefinition &definition)
break;
case OptionValue::eTypeString:
- // "definition.default_uint_value" can contain the string option flags OR'ed
- // together
- // "definition.default_cstr_value" can contain a default string value
+ // "definition.default_uint_value" can contain the string option flags
+ // OR'ed together "definition.default_cstr_value" can contain a default
+ // string value
{
OptionValueString *string_value =
new OptionValueString(definition.default_cstr_value);
OpenPOWER on IntegriCloud