diff options
author | Adrian Prantl <aprantl@apple.com> | 2018-04-30 16:49:04 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2018-04-30 16:49:04 +0000 |
commit | 05097246f352eca76207c9ebb08656c88bdf751a (patch) | |
tree | bfc4ec8250a939aaf4ade6fc6c528726183e5367 /lldb/source/DataFormatters/ValueObjectPrinter.cpp | |
parent | add59c052dd6768fd54431e6a3bf045e7f25cb59 (diff) | |
download | bcm5719-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/DataFormatters/ValueObjectPrinter.cpp')
-rw-r--r-- | lldb/source/DataFormatters/ValueObjectPrinter.cpp | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/lldb/source/DataFormatters/ValueObjectPrinter.cpp b/lldb/source/DataFormatters/ValueObjectPrinter.cpp index 863ff3af12e..43e91a2b6c9 100644 --- a/lldb/source/DataFormatters/ValueObjectPrinter.cpp +++ b/lldb/source/DataFormatters/ValueObjectPrinter.cpp @@ -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); |