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/Symbol/Symbol.cpp b/lldb/source/Symbol/Symbol.cpp
index ab297ef..69fd542 100644
--- a/lldb/source/Symbol/Symbol.cpp
+++ b/lldb/source/Symbol/Symbol.cpp
@@ -122,9 +122,9 @@
ConstString Symbol::GetReExportedSymbolName() const {
if (m_type == eSymbolTypeReExported) {
- // For eSymbolTypeReExported, the "const char *" from a ConstString
- // is used as the offset in the address range base address. We can
- // then make this back into a string that is the re-exported name.
+ // For eSymbolTypeReExported, the "const char *" from a ConstString is used
+ // as the offset in the address range base address. We can then make this
+ // back into a string that is the re-exported name.
intptr_t str_ptr = m_addr_range.GetBaseAddress().GetOffset();
if (str_ptr != 0)
return ConstString((const char *)str_ptr);
@@ -136,9 +136,9 @@
FileSpec Symbol::GetReExportedSymbolSharedLibrary() const {
if (m_type == eSymbolTypeReExported) {
- // For eSymbolTypeReExported, the "const char *" from a ConstString
- // is used as the offset in the address range base address. We can
- // then make this back into a string that is the re-exported name.
+ // For eSymbolTypeReExported, the "const char *" from a ConstString is used
+ // as the offset in the address range base address. We can then make this
+ // back into a string that is the re-exported name.
intptr_t str_ptr = m_addr_range.GetByteSize();
if (str_ptr != 0)
return FileSpec((const char *)str_ptr, false);
@@ -148,15 +148,15 @@
void Symbol::SetReExportedSymbolName(const ConstString &name) {
SetType(eSymbolTypeReExported);
- // For eSymbolTypeReExported, the "const char *" from a ConstString
- // is used as the offset in the address range base address.
+ // For eSymbolTypeReExported, the "const char *" from a ConstString is used
+ // as the offset in the address range base address.
m_addr_range.GetBaseAddress().SetOffset((uintptr_t)name.GetCString());
}
bool Symbol::SetReExportedSymbolSharedLibrary(const FileSpec &fspec) {
if (m_type == eSymbolTypeReExported) {
- // For eSymbolTypeReExported, the "const char *" from a ConstString
- // is used as the offset in the address range base address.
+ // For eSymbolTypeReExported, the "const char *" from a ConstString is used
+ // as the offset in the address range base address.
m_addr_range.SetByteSize(
(uintptr_t)ConstString(fspec.GetPath().c_str()).GetCString());
return true;
@@ -262,9 +262,8 @@
Function *function = base_address.CalculateSymbolContextFunction();
if (function) {
// Functions have line entries which can also potentially have end of
- // prologue information.
- // So if this symbol points to a function, use the prologue information
- // from there.
+ // prologue information. So if this symbol points to a function, use
+ // the prologue information from there.
m_type_data = function->GetPrologueByteSize();
} else {
ModuleSP module_sp(base_address.GetModule());
@@ -280,10 +279,9 @@
Address addr(base_address);
addr.Slide(m_type_data);
- // Check the first few instructions and look for one that has a line
- // number that is
- // different than the first entry. This is also done in
- // Function::GetPrologueByteSize().
+ // Check the first few instructions and look for one that has a
+ // line number that is different than the first entry. This is also
+ // done in Function::GetPrologueByteSize().
uint16_t total_offset = m_type_data;
for (int idx = 0; idx < 6; ++idx) {
SymbolContext sc_temp;
@@ -293,8 +291,8 @@
if (!(resolved_flags & eSymbolContextLineEntry))
break;
- // If this line number is different than our first one, use it and
- // we're done.
+ // If this line number is different than our first one, use it
+ // and we're done.
if (sc_temp.line_entry.line != sc.line_entry.line) {
m_type_data = total_offset;
break;
@@ -309,12 +307,10 @@
}
// Sanity check - this may be a function in the middle of code that
- // has debug information, but
- // not for this symbol. So the line entries surrounding us won't
- // lie inside our function.
- // In that case, the line entry will be bigger than we are, so we do
- // that quick check and
- // if that is true, we just return 0.
+ // has debug information, but not for this symbol. So the line
+ // entries surrounding us won't lie inside our function. In that
+ // case, the line entry will be bigger than we are, so we do that
+ // quick check and if that is true, we just return 0.
if (m_type_data >= m_addr_range.GetByteSize())
m_type_data = 0;
} else {
@@ -420,9 +416,9 @@
// Try searching for the module file spec first using the full path
module_sp = target.GetImages().FindFirstModule(module_spec);
if (!module_sp) {
- // Next try and find the module by basename in case environment
- // variables or other runtime trickery causes shared libraries
- // to be loaded from alternate paths
+ // Next try and find the module by basename in case environment variables
+ // or other runtime trickery causes shared libraries to be loaded from
+ // alternate paths
module_spec.GetFileSpec().GetDirectory().Clear();
module_sp = target.GetImages().FindFirstModule(module_spec);
}
@@ -430,8 +426,7 @@
if (module_sp) {
// There should not be cycles in the reexport list, but we don't want to
- // crash if there are so make sure
- // we haven't seen this before:
+ // crash if there are so make sure we haven't seen this before:
if (!seen_modules.AppendIfNeeded(module_sp))
return nullptr;
@@ -449,8 +444,8 @@
}
}
// If we didn't find the symbol in this module, it may be because this
- // module re-exports some
- // whole other library. We have to search those as well:
+ // module re-exports some whole other library. We have to search those as
+ // well:
seen_modules.Append(module_sp);
FileSpecList reexported_libraries =