From 05097246f352eca76207c9ebb08656c88bdf751a Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Mon, 30 Apr 2018 16:49:04 +0000 Subject: 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 --- lldb/source/Commands/CommandObjectExpression.cpp | 32 ++++++++++-------------- 1 file changed, 13 insertions(+), 19 deletions(-) (limited to 'lldb/source/Commands/CommandObjectExpression.cpp') diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp index fc62b39..9fe00f4 100644 --- a/lldb/source/Commands/CommandObjectExpression.cpp +++ b/lldb/source/Commands/CommandObjectExpression.cpp @@ -322,9 +322,9 @@ bool CommandObjectExpression::EvaluateExpression(const char *expr, Stream *output_stream, Stream *error_stream, CommandReturnObject *result) { - // Don't use m_exe_ctx as this might be called asynchronously - // after the command object DoExecute has finished when doing - // multi-line expression that use an input reader... + // Don't use m_exe_ctx as this might be called asynchronously after the + // command object DoExecute has finished when doing multi-line expression + // that use an input reader... ExecutionContext exe_ctx(m_interpreter.GetExecutionContext()); Target *target = exe_ctx.GetTargetPtr(); @@ -363,8 +363,8 @@ bool CommandObjectExpression::EvaluateExpression(const char *expr, if (m_command_options.top_level) options.SetExecutionPolicy(eExecutionPolicyTopLevel); - // If there is any chance we are going to stop and want to see - // what went wrong with our expression, we should generate debug info + // If there is any chance we are going to stop and want to see what went + // wrong with our expression, we should generate debug info if (!m_command_options.ignore_breakpoints || !m_command_options.unwind_on_error) options.SetGenerateDebugInfo(true); @@ -475,9 +475,8 @@ bool CommandObjectExpression::IOHandlerIsInputComplete(IOHandler &io_handler, // An empty lines is used to indicate the end of input const size_t num_lines = lines.GetSize(); if (num_lines > 0 && lines[num_lines - 1].empty()) { - // Remove the last empty line from "lines" so it doesn't appear - // in our resulting input and return true to indicate we are done - // getting lines + // Remove the last empty line from "lines" so it doesn't appear in our + // resulting input and return true to indicate we are done getting lines lines.PopBack(); return true; } @@ -562,19 +561,16 @@ bool CommandObjectExpression::DoExecute(const char *command, Debugger &debugger = target->GetDebugger(); // Check if the LLDB command interpreter is sitting on top of a REPL - // that - // launched it... + // that launched it... if (debugger.CheckTopIOHandlerTypes( IOHandler::Type::CommandInterpreter, IOHandler::Type::REPL)) { // the LLDB command interpreter is sitting on top of a REPL that - // launched it, - // so just say the command interpreter is done and fall back to the - // existing REPL + // launched it, so just say the command interpreter is done and + // fall back to the existing REPL m_interpreter.GetIOHandler(false)->SetIsDone(true); } else { // We are launching the REPL on top of the current LLDB command - // interpreter, - // so just push one + // interpreter, so just push one bool initialize = false; Status repl_error; REPLSP repl_sp(target->GetREPL( @@ -642,14 +638,12 @@ bool CommandObjectExpression::DoExecute(const char *command, } history.AppendString(fixed_command); } - // Increment statistics to record this expression evaluation - // success. + // Increment statistics to record this expression evaluation success. target->IncrementStats(StatisticKind::ExpressionSuccessful); return true; } - // Increment statistics to record this expression evaluation - // failure. + // Increment statistics to record this expression evaluation failure. target->IncrementStats(StatisticKind::ExpressionFailure); result.SetStatus(eReturnStatusFailed); return false; -- cgit v1.1