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
This commit is contained in:
@@ -26,9 +26,8 @@ using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
using namespace lldb_private::formatters;
|
||||
|
||||
// we define this for all values of type but only implement it for those we care
|
||||
// about
|
||||
// that's good because we get linker errors for any unsupported type
|
||||
// we define this for all values of type but only implement it for those we
|
||||
// care about that's good because we get linker errors for any unsupported type
|
||||
template <lldb_private::formatters::StringPrinter::StringElementType type>
|
||||
static StringPrinter::StringPrinterBufferPointer<>
|
||||
GetPrintableImpl(uint8_t *buffer, uint8_t *buffer_end, uint8_t *&next);
|
||||
@@ -163,8 +162,8 @@ GetPrintableImpl<StringPrinter::StringElementType::UTF8>(uint8_t *buffer,
|
||||
(unsigned char)*(buffer + 2), (unsigned char)*(buffer + 3));
|
||||
break;
|
||||
default:
|
||||
// this is probably some bogus non-character thing
|
||||
// just print it as-is and hope to sync up again soon
|
||||
// this is probably some bogus non-character thing just print it as-is and
|
||||
// hope to sync up again soon
|
||||
retval = {buffer, 1};
|
||||
next = buffer + 1;
|
||||
return retval;
|
||||
@@ -223,9 +222,9 @@ GetPrintableImpl<StringPrinter::StringElementType::UTF8>(uint8_t *buffer,
|
||||
return retval;
|
||||
}
|
||||
|
||||
// Given a sequence of bytes, this function returns:
|
||||
// a sequence of bytes to actually print out + a length
|
||||
// the following unscanned position of the buffer is in next
|
||||
// Given a sequence of bytes, this function returns: a sequence of bytes to
|
||||
// actually print out + a length the following unscanned position of the buffer
|
||||
// is in next
|
||||
static StringPrinter::StringPrinterBufferPointer<>
|
||||
GetPrintable(StringPrinter::StringElementType type, uint8_t *buffer,
|
||||
uint8_t *buffer_end, uint8_t *&next) {
|
||||
@@ -321,8 +320,7 @@ static bool DumpUTFBufferToStream(
|
||||
(llvm::UTF8 *)utf8_data_buffer_sp->GetBytes();
|
||||
} else {
|
||||
// just copy the pointers - the cast is necessary to make the compiler
|
||||
// happy
|
||||
// but this should only happen if we are reading UTF8 data
|
||||
// happy but this should only happen if we are reading UTF8 data
|
||||
utf8_data_ptr = const_cast<llvm::UTF8 *>(
|
||||
reinterpret_cast<const llvm::UTF8 *>(data_ptr));
|
||||
utf8_data_end_ptr = const_cast<llvm::UTF8 *>(
|
||||
@@ -344,8 +342,8 @@ static bool DumpUTFBufferToStream(
|
||||
}
|
||||
|
||||
// since we tend to accept partial data (and even partially malformed data)
|
||||
// we might end up with no NULL terminator before the end_ptr
|
||||
// hence we need to take a slower route and ensure we stay within boundaries
|
||||
// we might end up with no NULL terminator before the end_ptr hence we need
|
||||
// to take a slower route and ensure we stay within boundaries
|
||||
for (; utf8_data_ptr < utf8_data_end_ptr;) {
|
||||
if (zero_is_terminator && !*utf8_data_ptr)
|
||||
break;
|
||||
@@ -472,8 +470,8 @@ bool StringPrinter::ReadStringAndDumpToStream<
|
||||
}
|
||||
|
||||
// since we tend to accept partial data (and even partially malformed data)
|
||||
// we might end up with no NULL terminator before the end_ptr
|
||||
// hence we need to take a slower route and ensure we stay within boundaries
|
||||
// we might end up with no NULL terminator before the end_ptr hence we need
|
||||
// to take a slower route and ensure we stay within boundaries
|
||||
for (uint8_t *data = buffer_sp->GetBytes(); *data && (data < data_end);) {
|
||||
if (escape_non_printables) {
|
||||
uint8_t *next_data = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user