mirror of
https://github.com/intel/llvm.git
synced 2026-01-15 20:54:40 +08:00
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:
@@ -244,8 +244,8 @@ void ValueObjectPrinter::PrintDecl() {
|
||||
|
||||
// always show the type at the root level if it is invalid
|
||||
if (show_type) {
|
||||
// Some ValueObjects don't have types (like registers sets). Only print
|
||||
// the type if there is one to print
|
||||
// Some ValueObjects don't have types (like registers sets). Only print the
|
||||
// type if there is one to print
|
||||
ConstString type_name;
|
||||
if (m_compiler_type.IsValid()) {
|
||||
if (m_options.m_use_type_display_name)
|
||||
@@ -402,12 +402,10 @@ bool ValueObjectPrinter::PrintValueAndSummaryIfNeeded(bool &value_printed,
|
||||
}
|
||||
if (m_error.size()) {
|
||||
// we need to support scenarios in which it is actually fine for a value
|
||||
// to have no type
|
||||
// but - on the other hand - if we get an error *AND* have no type, we try
|
||||
// to get out
|
||||
// gracefully, since most often that combination means "could not resolve
|
||||
// a type"
|
||||
// and the default failure mode is quite ugly
|
||||
// to have no type but - on the other hand - if we get an error *AND*
|
||||
// have no type, we try to get out gracefully, since most often that
|
||||
// combination means "could not resolve a type" and the default failure
|
||||
// mode is quite ugly
|
||||
if (!m_compiler_type.IsValid()) {
|
||||
m_stream->Printf(" <could not resolve type>");
|
||||
return false;
|
||||
@@ -416,10 +414,10 @@ bool ValueObjectPrinter::PrintValueAndSummaryIfNeeded(bool &value_printed,
|
||||
error_printed = true;
|
||||
m_stream->Printf(" <%s>\n", m_error.c_str());
|
||||
} else {
|
||||
// Make sure we have a value and make sure the summary didn't
|
||||
// specify that the value should not be printed - and do not print
|
||||
// the value if this thing is nil
|
||||
// (but show the value if the user passes a format explicitly)
|
||||
// Make sure we have a value and make sure the summary didn't specify
|
||||
// that the value should not be printed - and do not print the value if
|
||||
// this thing is nil (but show the value if the user passes a format
|
||||
// explicitly)
|
||||
TypeSummaryImpl *entry = GetSummaryFormatter();
|
||||
if (!IsNil() && !IsUninitialized() && !m_value.empty() &&
|
||||
(entry == NULL || (entry->DoesPrintValue(m_valobj) ||
|
||||
@@ -494,8 +492,8 @@ bool ValueObjectPrinter::ShouldPrintChildren(
|
||||
if (is_uninit)
|
||||
return false;
|
||||
|
||||
// if the user has specified an element count, always print children
|
||||
// as it is explicit user demand being honored
|
||||
// if the user has specified an element count, always print children as it is
|
||||
// explicit user demand being honored
|
||||
if (m_options.m_pointer_as_array)
|
||||
return true;
|
||||
|
||||
@@ -505,17 +503,16 @@ bool ValueObjectPrinter::ShouldPrintChildren(
|
||||
return false;
|
||||
|
||||
if (is_failed_description || m_curr_depth < m_options.m_max_depth) {
|
||||
// We will show children for all concrete types. We won't show
|
||||
// pointer contents unless a pointer depth has been specified.
|
||||
// We won't reference contents unless the reference is the
|
||||
// root object (depth of zero).
|
||||
// We will show children for all concrete types. We won't show pointer
|
||||
// contents unless a pointer depth has been specified. We won't reference
|
||||
// contents unless the reference is the root object (depth of zero).
|
||||
|
||||
// Use a new temporary pointer depth in case we override the
|
||||
// current pointer depth below...
|
||||
// Use a new temporary pointer depth in case we override the current
|
||||
// pointer depth below...
|
||||
|
||||
if (is_ptr || is_ref) {
|
||||
// We have a pointer or reference whose value is an address.
|
||||
// Make sure that address is not NULL
|
||||
// We have a pointer or reference whose value is an address. Make sure
|
||||
// that address is not NULL
|
||||
AddressType ptr_address_type;
|
||||
if (m_valobj->GetPointerValue(&ptr_address_type) == 0)
|
||||
return false;
|
||||
@@ -523,10 +520,10 @@ bool ValueObjectPrinter::ShouldPrintChildren(
|
||||
const bool is_root_level = m_curr_depth == 0;
|
||||
|
||||
if (is_ref && is_root_level) {
|
||||
// If this is the root object (depth is zero) that we are showing
|
||||
// and it is a reference, and no pointer depth has been supplied
|
||||
// print out what it references. Don't do this at deeper depths
|
||||
// otherwise we can end up with infinite recursion...
|
||||
// If this is the root object (depth is zero) that we are showing and
|
||||
// it is a reference, and no pointer depth has been supplied print out
|
||||
// what it references. Don't do this at deeper depths otherwise we can
|
||||
// end up with infinite recursion...
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -759,8 +756,7 @@ bool ValueObjectPrinter::PrintChildrenOneLiner(bool hide_names) {
|
||||
void ValueObjectPrinter::PrintChildrenIfNeeded(bool value_printed,
|
||||
bool summary_printed) {
|
||||
// this flag controls whether we tried to display a description for this
|
||||
// object and failed
|
||||
// if that happens, we want to display the children, if any
|
||||
// object and failed if that happens, we want to display the children, if any
|
||||
bool is_failed_description =
|
||||
!PrintObjectDescriptionIfNeeded(value_printed, summary_printed);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user