aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Interpreter/CommandObject.cpp
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/CommandObject.cpp
parentadd59c052dd6768fd54431e6a3bf045e7f25cb59 (diff)
downloadllvm-05097246f352eca76207c9ebb08656c88bdf751a.zip
llvm-05097246f352eca76207c9ebb08656c88bdf751a.tar.gz
llvm-05097246f352eca76207c9ebb08656c88bdf751a.tar.bz2
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/CommandObject.cpp')
-rw-r--r--lldb/source/Interpreter/CommandObject.cpp49
1 files changed, 23 insertions, 26 deletions
diff --git a/lldb/source/Interpreter/CommandObject.cpp b/lldb/source/Interpreter/CommandObject.cpp
index f4fb5ea..74b83d5 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);
}