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
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index c09139f..7d13bb9 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -146,16 +146,15 @@
if (update_format)
did_change_formats = UpdateFormatsIfNeeded();
- // If this is a constant value, then our success is predicated on whether
- // we have an error or not
+ // If this is a constant value, then our success is predicated on whether we
+ // have an error or not
if (GetIsConstant()) {
// if you are constant, things might still have changed behind your back
// (e.g. you are a frozen object and things have changed deeper than you
- // cared to freeze-dry yourself)
- // in this case, your value has not changed, but "computed" entries might
- // have, so you might now have
- // a different summary, or a different object description. clear these so we
- // will recompute them
+ // cared to freeze-dry yourself) in this case, your value has not changed,
+ // but "computed" entries might have, so you might now have a different
+ // summary, or a different object description. clear these so we will
+ // recompute them
if (update_format && !did_change_formats)
ClearUserVisibleData(eClearUserVisibleDataItemsSummary |
eClearUserVisibleDataItemsDescription);
@@ -167,8 +166,8 @@
if (NeedsUpdating()) {
m_update_point.SetUpdated();
- // Save the old value using swap to avoid a string copy which
- // also will clear our m_value_str
+ // Save the old value using swap to avoid a string copy which also will
+ // clear our m_value_str
if (m_value_str.empty()) {
m_old_value_valid = false;
} else {
@@ -215,8 +214,8 @@
if (first_update)
SetValueDidChange(false);
else if (!m_value_did_change && success == false) {
- // The value wasn't gotten successfully, so we mark this
- // as changed if the value used to be valid and now isn't
+ // The value wasn't gotten successfully, so we mark this as changed if
+ // the value used to be valid and now isn't
SetValueDidChange(value_was_valid);
} else if (need_compare_checksums) {
SetValueDidChange(memcmp(&old_checksum[0], &m_value_checksum[0],
@@ -261,8 +260,7 @@
void ValueObject::SetNeedsUpdate() {
m_update_point.SetNeedsUpdate();
// We have to clear the value string here so ConstResult children will notice
- // if their values are
- // changed by hand (i.e. with SetValueAsCString).
+ // if their values are changed by hand (i.e. with SetValueAsCString).
ClearUserVisibleData(eClearUserVisibleDataItemsValue);
}
@@ -556,9 +554,9 @@
ValueObjectSP ValueObject::GetChildMemberWithName(const ConstString &name,
bool can_create) {
- // when getting a child by name, it could be buried inside some base
- // classes (which really aren't part of the expression path), so we
- // need a vector of indexes that can get us down to the correct child
+ // when getting a child by name, it could be buried inside some base classes
+ // (which really aren't part of the expression path), so we need a vector of
+ // indexes that can get us down to the correct child
ValueObjectSP child_sp;
// We may need to update our value if we are dynamic
@@ -682,8 +680,8 @@
const TypeSummaryOptions &options) {
destination.clear();
- // ideally we would like to bail out if passing NULL, but if we do so
- // we end up not providing the summary for function pointers anymore
+ // ideally we would like to bail out if passing NULL, but if we do so we end
+ // up not providing the summary for function pointers anymore
if (/*summary_ptr == NULL ||*/ m_is_getting_summary)
return false;
@@ -695,9 +693,8 @@
actual_options.SetLanguage(GetPreferredDisplayLanguage());
// this is a hot path in code and we prefer to avoid setting this string all
- // too often also clearing out other
- // information that we might care to see in a crash log. might be useful in
- // very specific situations though.
+ // too often also clearing out other information that we might care to see in
+ // a crash log. might be useful in very specific situations though.
/*Host::SetCrashDescriptionWithFormat("Trying to fetch a summary for %s %s.
Summary provider's description is %s",
GetTypeName().GetCString(),
@@ -925,7 +922,8 @@
break;
}
- // If we have reached this point, then we have successfully changed the value.
+ // If we have reached this point, then we have successfully changed the
+ // value.
SetNeedsUpdate();
return true;
}
@@ -1010,9 +1008,9 @@
DataExtractor data;
if (cstr_len > 0 && honor_array) {
// I am using GetPointeeData() here to abstract the fact that some
- // ValueObjects are actually frozen pointers in the host
- // but the pointed-to data lives in the debuggee, and GetPointeeData()
- // automatically takes care of this
+ // ValueObjects are actually frozen pointers in the host but the pointed-
+ // to data lives in the debuggee, and GetPointeeData() automatically
+ // takes care of this
GetPointeeData(data, 0, cstr_len);
if ((bytes_read = data.GetByteSize()) > 0) {
@@ -1031,9 +1029,9 @@
int cstr_len_displayed = -1;
bool capped_cstr = false;
// I am using GetPointeeData() here to abstract the fact that some
- // ValueObjects are actually frozen pointers in the host
- // but the pointed-to data lives in the debuggee, and GetPointeeData()
- // automatically takes care of this
+ // ValueObjects are actually frozen pointers in the host but the pointed-
+ // to data lives in the debuggee, and GetPointeeData() automatically
+ // takes care of this
while ((bytes_read = GetPointeeData(data, offset, k_max_buf_size)) > 0) {
total_bytes_read += bytes_read;
const char *cstr = data.PeekCStr(0);
@@ -1175,8 +1173,8 @@
format_sp.reset(new TypeFormatImpl_Format(my_format));
if (GetValueAsCString(*format_sp.get(), m_value_str)) {
if (!m_value_did_change && m_old_value_valid) {
- // The value was gotten successfully, so we consider the
- // value as changed if the value string differs
+ // The value was gotten successfully, so we consider the value as
+ // changed if the value string differs
SetValueDidChange(m_old_value_str != m_value_str);
}
}
@@ -1187,8 +1185,8 @@
return m_value_str.c_str();
}
-// if > 8bytes, 0 is returned. this method should mostly be used
-// to read address values out of pointers
+// if > 8bytes, 0 is returned. this method should mostly be used to read
+// address values out of pointers
uint64_t ValueObject::GetValueAsUnsigned(uint64_t fail_value, bool *success) {
// If our byte size is zero this is an aggregate type that has children
if (CanProvideValue()) {
@@ -1224,10 +1222,9 @@
}
// if any more "special cases" are added to
-// ValueObject::DumpPrintableRepresentation() please keep
-// this call up to date by returning true for your new special cases. We will
-// eventually move
-// to checking this call result before trying to display special cases
+// ValueObject::DumpPrintableRepresentation() please keep this call up to date
+// by returning true for your new special cases. We will eventually move to
+// checking this call result before trying to display special cases
bool ValueObject::HasSpecialPrintableRepresentation(
ValueObjectRepresentationStyle val_obj_display, Format custom_format) {
Flags flags(GetTypeInfo());
@@ -1276,8 +1273,7 @@
if (flags.AnySet(eTypeIsArray | eTypeIsPointer) &&
val_obj_display == ValueObject::eValueObjectRepresentationStyleValue) {
// when being asked to get a printable display an array or pointer type
- // directly,
- // try to "do the right thing"
+ // directly, try to "do the right thing"
if (IsCStringContainer(true) &&
(custom_format == eFormatCString ||
@@ -1309,8 +1305,8 @@
if (custom_format == eFormatEnum)
return false;
- // this only works for arrays, because I have no way to know when
- // the pointed memory ends, and no special \0 end of data marker
+ // this only works for arrays, because I have no way to know when the
+ // pointed memory ends, and no special \0 end of data marker
if (flags.Test(eTypeIsArray)) {
if ((custom_format == eFormatBytes) ||
(custom_format == eFormatBytesWithASCII)) {
@@ -1406,8 +1402,8 @@
llvm::StringRef str;
// this is a local stream that we are using to ensure that the data pointed
- // to by cstr survives long enough for us to copy it to its destination - it
- // is necessary to have this temporary storage area for cases where our
+ // to by cstr survives long enough for us to copy it to its destination -
+ // it is necessary to have this temporary storage area for cases where our
// desired output is not backed by some other longer-term storage
StreamString strm;
@@ -1485,9 +1481,9 @@
s.PutCString("<no printable representation>");
}
- // we should only return false here if we could not do *anything*
- // even if we have an error message as output, that's a success
- // from our callers' perspective, so return true
+ // we should only return false here if we could not do *anything* even if
+ // we have an error message as output, that's a success from our callers'
+ // perspective, so return true
var_success = true;
if (custom_format != eFormatInvalid)
@@ -1590,9 +1586,8 @@
switch (value_type) {
case Value::eValueTypeLoadAddress: {
// If it is a load address, then the scalar value is the storage
- // location
- // of the data, and we have to shove this value down to that load
- // location.
+ // location of the data, and we have to shove this value down to that
+ // load location.
ExecutionContext exe_ctx(GetExecutionContextRef());
Process *process = exe_ctx.GetProcessPtr();
if (process) {
@@ -1639,7 +1634,8 @@
return false;
}
- // If we have reached this point, then we have successfully changed the value.
+ // If we have reached this point, then we have successfully changed the
+ // value.
SetNeedsUpdate();
return true;
}
@@ -1734,16 +1730,14 @@
return false;
}
-// This allows you to create an array member using and index
-// that doesn't not fall in the normal bounds of the array.
-// Many times structure can be defined as:
-// struct Collection
-// {
+// This allows you to create an array member using and index that doesn't not
+// fall in the normal bounds of the array. Many times structure can be defined
+// as: struct Collection {
// uint32_t item_count;
// Item item_array[0];
// };
-// The size of the "item_array" is 1, but many times in practice
-// there are more items in "item_array".
+// The size of the "item_array" is 1, but many times in practice there are more
+// items in "item_array".
ValueObjectSP ValueObject::GetSyntheticArrayMember(size_t index,
bool can_create) {
@@ -1752,13 +1746,13 @@
char index_str[64];
snprintf(index_str, sizeof(index_str), "[%" PRIu64 "]", (uint64_t)index);
ConstString index_const_str(index_str);
- // Check if we have already created a synthetic array member in this
- // valid object. If we have we will re-use it.
+ // Check if we have already created a synthetic array member in this valid
+ // object. If we have we will re-use it.
synthetic_child_sp = GetSyntheticChild(index_const_str);
if (!synthetic_child_sp) {
ValueObject *synthetic_child;
- // We haven't made a synthetic array member for INDEX yet, so
- // lets make one and cache it for any future reference.
+ // We haven't made a synthetic array member for INDEX yet, so lets make
+ // one and cache it for any future reference.
synthetic_child = CreateChildAtIndex(0, true, index);
// Cache the value if we got one back...
@@ -1780,8 +1774,8 @@
char index_str[64];
snprintf(index_str, sizeof(index_str), "[%i-%i]", from, to);
ConstString index_const_str(index_str);
- // Check if we have already created a synthetic array member in this
- // valid object. If we have we will re-use it.
+ // Check if we have already created a synthetic array member in this valid
+ // object. If we have we will re-use it.
synthetic_child_sp = GetSyntheticChild(index_const_str);
if (!synthetic_child_sp) {
uint32_t bit_field_size = to - from + 1;
@@ -1789,8 +1783,8 @@
if (GetDataExtractor().GetByteOrder() == eByteOrderBig)
bit_field_offset =
GetByteSize() * 8 - bit_field_size - bit_field_offset;
- // We haven't made a synthetic array member for INDEX yet, so
- // lets make one and cache it for any future reference.
+ // We haven't made a synthetic array member for INDEX yet, so lets make
+ // one and cache it for any future reference.
ValueObjectChild *synthetic_child = new ValueObjectChild(
*this, GetCompilerType(), index_const_str, GetByteSize(), 0,
bit_field_size, bit_field_offset, false, false, eAddressTypeInvalid,
@@ -1820,8 +1814,8 @@
name_const_str.SetCString(name_str);
}
- // Check if we have already created a synthetic array member in this
- // valid object. If we have we will re-use it.
+ // Check if we have already created a synthetic array member in this valid
+ // object. If we have we will re-use it.
synthetic_child_sp = GetSyntheticChild(name_const_str);
if (synthetic_child_sp.get())
@@ -1858,8 +1852,8 @@
name_const_str.SetCString(name_str);
}
- // Check if we have already created a synthetic array member in this
- // valid object. If we have we will re-use it.
+ // Check if we have already created a synthetic array member in this valid
+ // object. If we have we will re-use it.
synthetic_child_sp = GetSyntheticChild(name_const_str);
if (synthetic_child_sp.get())
@@ -1884,11 +1878,10 @@
return synthetic_child_sp;
}
-// your expression path needs to have a leading . or ->
-// (unless it somehow "looks like" an array, in which case it has
-// a leading [ symbol). while the [ is meaningful and should be shown
-// to the user, . and -> are just parser design, but by no means
-// added information for the user.. strip them off
+// your expression path needs to have a leading . or -> (unless it somehow
+// "looks like" an array, in which case it has a leading [ symbol). while the [
+// is meaningful and should be shown to the user, . and -> are just parser
+// design, but by no means added information for the user.. strip them off
static const char *SkipLeadingExpressionPathSeparators(const char *expression) {
if (!expression || !expression[0])
return expression;
@@ -1904,12 +1897,12 @@
bool can_create) {
ValueObjectSP synthetic_child_sp;
ConstString name_const_string(expression);
- // Check if we have already created a synthetic array member in this
- // valid object. If we have we will re-use it.
+ // Check if we have already created a synthetic array member in this valid
+ // object. If we have we will re-use it.
synthetic_child_sp = GetSyntheticChild(name_const_string);
if (!synthetic_child_sp) {
- // We haven't made a synthetic array member for expression yet, so
- // lets make one and cache it for any future reference.
+ // We haven't made a synthetic array member for expression yet, so lets
+ // make one and cache it for any future reference.
synthetic_child_sp = GetValueForExpressionPath(
expression, NULL, NULL,
GetValueForExpressionPathOptions().SetSyntheticChildrenTraversal(
@@ -2055,10 +2048,9 @@
void ValueObject::GetExpressionPath(Stream &s, bool qualify_cxx_base_classes,
GetExpressionPathFormat epformat) {
// synthetic children do not actually "exist" as part of the hierarchy, and
- // sometimes they are consed up in ways
- // that don't make sense from an underlying language/API standpoint. So, use a
- // special code path here to return
- // something that can hopefully be used in expression
+ // sometimes they are consed up in ways that don't make sense from an
+ // underlying language/API standpoint. So, use a special code path here to
+ // return something that can hopefully be used in expression
if (m_is_synthetic_children_generated) {
UpdateValueIfNeeded();
@@ -2092,11 +2084,10 @@
if (is_deref_of_parent &&
epformat == eGetExpressionPathFormatDereferencePointers) {
// this is the original format of GetExpressionPath() producing code like
- // *(a_ptr).memberName, which is entirely
- // fine, until you put this into
+ // *(a_ptr).memberName, which is entirely fine, until you put this into
// StackFrame::GetValueForVariableExpressionPath() which prefers to see
- // a_ptr->memberName.
- // the eHonorPointers mode is meant to produce strings in this latter format
+ // a_ptr->memberName. the eHonorPointers mode is meant to produce strings
+ // in this latter format
s.PutCString("*(");
}
@@ -2105,9 +2096,9 @@
if (parent)
parent->GetExpressionPath(s, qualify_cxx_base_classes, epformat);
- // if we are a deref_of_parent just because we are synthetic array
- // members made up to allow ptr[%d] syntax to work in variable
- // printing, then add our name ([%d]) to the expression path
+ // if we are a deref_of_parent just because we are synthetic array members
+ // made up to allow ptr[%d] syntax to work in variable printing, then add our
+ // name ([%d]) to the expression path
if (m_is_array_item_for_pointer &&
epformat == eGetExpressionPathFormatHonorPointers)
s.PutCString(m_name.AsCString());
@@ -2355,8 +2346,8 @@
}
// if we are here and options.m_no_synthetic_children is true,
- // child_valobj_sp is going to be a NULL SP,
- // so we hit the "else" branch, and return an error
+ // child_valobj_sp is going to be a NULL SP, so we hit the "else"
+ // branch, and return an error
if (child_valobj_sp.get()) // if it worked, just return
{
*reason_to_stop =
@@ -2424,8 +2415,8 @@
}
// if we are here and options.m_no_synthetic_children is true,
- // child_valobj_sp is going to be a NULL SP,
- // so we hit the "else" branch, and return an error
+ // child_valobj_sp is going to be a NULL SP, so we hit the "else"
+ // branch, and return an error
if (child_valobj_sp.get()) // if it worked, move on
{
root = child_valobj_sp;
@@ -2506,8 +2497,8 @@
assert(!bracket_expr.empty());
if (!bracket_expr.contains('-')) {
- // if no separator, this is of the form [N]. Note that this cannot
- // be an unbounded range of the form [], because that case was handled
+ // if no separator, this is of the form [N]. Note that this cannot be
+ // an unbounded range of the form [], because that case was handled
// above with an unconditional return.
unsigned long index = 0;
if (bracket_expr.getAsInteger(0, index)) {
@@ -2631,8 +2622,8 @@
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
return nullptr;
}
- // if we are here, then root itself is a synthetic VO.. should be good
- // to go
+ // if we are here, then root itself is a synthetic VO.. should be
+ // good to go
if (!root) {
*reason_to_stop =
@@ -3031,20 +3022,17 @@
ValueObject::EvaluationPoint::~EvaluationPoint() {}
// This function checks the EvaluationPoint against the current process state.
-// If the current
-// state matches the evaluation point, or the evaluation point is already
-// invalid, then we return
-// false, meaning "no change". If the current state is different, we update our
-// state, and return
-// true meaning "yes, change". If we did see a change, we also set
-// m_needs_update to true, so
-// future calls to NeedsUpdate will return true.
-// exe_scope will be set to the current execution context scope.
+// If the current state matches the evaluation point, or the evaluation point
+// is already invalid, then we return false, meaning "no change". If the
+// current state is different, we update our state, and return true meaning
+// "yes, change". If we did see a change, we also set m_needs_update to true,
+// so future calls to NeedsUpdate will return true. exe_scope will be set to
+// the current execution context scope.
bool ValueObject::EvaluationPoint::SyncWithProcessState(
bool accept_invalid_exe_ctx) {
- // Start with the target, if it is NULL, then we're obviously not going to get
- // any further:
+ // Start with the target, if it is NULL, then we're obviously not going to
+ // get any further:
const bool thread_and_frame_only_if_stopped = true;
ExecutionContext exe_ctx(
m_exe_ctx_ref.Lock(thread_and_frame_only_if_stopped));
@@ -3061,8 +3049,8 @@
ProcessModID current_mod_id = process->GetModID();
// If the current stop id is 0, either we haven't run yet, or the process
- // state has been cleared.
- // In either case, we aren't going to be able to sync with the process state.
+ // state has been cleared. In either case, we aren't going to be able to sync
+ // with the process state.
if (current_mod_id.GetStopID() == 0)
return false;
@@ -3070,8 +3058,8 @@
const bool was_valid = m_mod_id.IsValid();
if (was_valid) {
if (m_mod_id == current_mod_id) {
- // Everything is already up to date in this object, no need to
- // update the execution context scope.
+ // Everything is already up to date in this object, no need to update the
+ // execution context scope.
changed = false;
} else {
m_mod_id = current_mod_id;
@@ -3081,10 +3069,9 @@
}
// Now re-look up the thread and frame in case the underlying objects have
- // gone away & been recreated.
- // That way we'll be sure to return a valid exe_scope.
- // If we used to have a thread or a frame but can't find it anymore, then mark
- // ourselves as invalid.
+ // gone away & been recreated. That way we'll be sure to return a valid
+ // exe_scope. If we used to have a thread or a frame but can't find it
+ // anymore, then mark ourselves as invalid.
if (!accept_invalid_exe_ctx) {
if (m_exe_ctx_ref.HasThreadRef()) {
@@ -3299,11 +3286,9 @@
}
bool ValueObject::CanProvideValue() {
- // we need to support invalid types as providers of values because some
- // bare-board
- // debugging scenarios have no notion of types, but still manage to have raw
- // numeric
- // values for things like registers. sigh.
+ // we need to support invalid types as providers of values because some bare-
+ // board debugging scenarios have no notion of types, but still manage to
+ // have raw numeric values for things like registers. sigh.
const CompilerType &type(GetCompilerType());
return (false == type.IsValid()) ||
(0 != (type.GetTypeInfo() & eTypeHasValue));