summaryrefslogtreecommitdiffstats
path: root/lldb/source/Utility/FastDemangle.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2018-04-30 16:49:04 +0000
committerAdrian Prantl <aprantl@apple.com>2018-04-30 16:49:04 +0000
commit05097246f352eca76207c9ebb08656c88bdf751a (patch)
treebfc4ec8250a939aaf4ade6fc6c528726183e5367 /lldb/source/Utility/FastDemangle.cpp
parentadd59c052dd6768fd54431e6a3bf045e7f25cb59 (diff)
downloadbcm5719-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/Utility/FastDemangle.cpp')
-rw-r--r--lldb/source/Utility/FastDemangle.cpp83
1 files changed, 39 insertions, 44 deletions
diff --git a/lldb/source/Utility/FastDemangle.cpp b/lldb/source/Utility/FastDemangle.cpp
index 90326c5f15c..cc045264c7b 100644
--- a/lldb/source/Utility/FastDemangle.cpp
+++ b/lldb/source/Utility/FastDemangle.cpp
@@ -200,8 +200,7 @@ private:
if (growth > 1 << 20)
growth = 1 << 20;
- // ... but never grow by less than requested,
- // or 1K, whichever is greater
+ // ... but never grow by less than requested, or 1K, whichever is greater
if (min_growth < 1024)
min_growth = 1024;
if (growth < min_growth)
@@ -282,9 +281,8 @@ private:
if (index == m_rewrite_ranges_size)
break;
- // Affected ranges are either shuffled forward when after the
- // insertion but before the source, or backward when inside the
- // source
+ // Affected ranges are either shuffled forward when after the insertion
+ // but before the source, or backward when inside the source
int candidate_offset = m_rewrite_ranges[index].offset;
if (candidate_offset >= insertion_point_cookie) {
if (candidate_offset < source_range.offset) {
@@ -402,8 +400,7 @@ private:
//----------------------------------------------------
// Rewrite methods
//
- // Write another copy of content already present
- // earlier in the output buffer
+ // Write another copy of content already present earlier in the output buffer
//----------------------------------------------------
void RewriteRange(BufferRange range) {
@@ -436,11 +433,11 @@ private:
//----------------------------------------------------
// TryParse methods
//
- // Provide information with return values instead of
- // writing to the output buffer
+ // Provide information with return values instead of writing to the output
+ // buffer
//
- // Values indicating failure guarantee that the pre-
- // call m_read_ptr is unchanged
+ // Values indicating failure guarantee that the pre- call m_read_ptr is
+ // unchanged
//----------------------------------------------------
int TryParseNumber() {
@@ -820,8 +817,8 @@ private:
}
// <CV-qualifiers> ::= [r] [V] [K]
- // <ref-qualifier> ::= R # & ref-qualifier
- // <ref-qualifier> ::= O # && ref-qualifier
+ // <ref-qualifier> ::= R # & ref-qualifier <ref-qualifier>
+ // ::= O # && ref-qualifier
int TryParseQualifiers(bool allow_cv, bool allow_ro) {
int qualifiers = QualifierNone;
@@ -890,11 +887,10 @@ private:
//----------------------------------------------------
// Parse methods
//
- // Consume input starting from m_read_ptr and produce
- // buffered output at m_write_ptr
+ // Consume input starting from m_read_ptr and produce buffered output at
+ // m_write_ptr
//
- // Failures return false and may leave m_read_ptr in an
- // indeterminate state
+ // Failures return false and may leave m_read_ptr in an indeterminate state
//----------------------------------------------------
bool Parse(char character) {
@@ -932,17 +928,14 @@ private:
// <substitution> ::= S <seq-id> _
// ::= S_
- // <substitution> ::= Sa # ::std::allocator
- // <substitution> ::= Sb # ::std::basic_string
- // <substitution> ::= Ss # ::std::basic_string < char,
+ // <substitution> ::= Sa # ::std::allocator <substitution> ::= Sb #
+ // ::std::basic_string <substitution> ::= Ss # ::std::basic_string < char,
// ::std::char_traits<char>,
// ::std::allocator<char> >
// <substitution> ::= Si # ::std::basic_istream<char, std::char_traits<char>
- // >
- // <substitution> ::= So # ::std::basic_ostream<char, std::char_traits<char>
- // >
- // <substitution> ::= Sd # ::std::basic_iostream<char, std::char_traits<char>
- // >
+ // > <substitution> ::= So # ::std::basic_ostream<char,
+ // std::char_traits<char> > <substitution> ::= Sd #
+ // ::std::basic_iostream<char, std::char_traits<char> >
bool ParseSubstitution() {
const char *substitution;
@@ -967,7 +960,8 @@ private:
break;
default:
// A failed attempt to parse a number will return -1 which turns out to be
- // perfect here as S_ is the first substitution, S0_ the next and so forth
+ // perfect here as S_ is the first substitution, S0_ the next and so
+ // forth
int substitution_index = TryParseBase36Number();
if (*m_read_ptr++ != '_') {
#ifdef DEBUG_FAILURES
@@ -984,17 +978,17 @@ private:
// <function-type> ::= F [Y] <bare-function-type> [<ref-qualifier>] E
//
- // <bare-function-type> ::= <signature type>+ # types are possible return
- // type, then parameter types
+ // <bare-function-type> ::= <signature type>+ # types are possible
+ // return type, then parameter types
bool ParseFunctionType(int inner_qualifiers = QualifierNone) {
#ifdef DEBUG_FAILURES
printf("*** Function types not supported\n");
#endif
// TODO: first steps toward an implementation follow, but they're far
- // from complete. Function types tend to bracket other types eg:
- // int (*)() when used as the type for "name" becomes int (*name)().
- // This makes substitution et al ... interesting.
+ // from complete. Function types tend to bracket other types eg: int (*)()
+ // when used as the type for "name" becomes int (*name)(). This makes
+ // substitution et al ... interesting.
return false;
#if 0 // TODO
@@ -1154,8 +1148,8 @@ private:
if (!Parse('_'))
return false;
- // When no number is present we get -1, which is convenient since
- // T_ is the zeroth element T0_ is element 1, and so on
+ // When no number is present we get -1, which is convenient since T_ is the
+ // zeroth element T0_ is element 1, and so on
return RewriteTemplateArg(count + 1);
}
@@ -1193,13 +1187,13 @@ private:
// ::= G <type> # imaginary (C 2000)
// ::= Dp <type> # pack expansion (C++0x)
// ::= U <source-name> <type> # vendor extended type qualifier
- // extension := U <objc-name> <objc-type> # objc-type<identifier>
- // extension := <vector-type> # <vector-type> starts with Dv
+ // extension := U <objc-name> <objc-type> # objc-type<identifier> extension
+ // := <vector-type> # <vector-type> starts with Dv
// <objc-name> ::= <k0 number> objcproto <k1 number> <identifier> # k0 = 9 +
- // <number of digits in k1> + k1
- // <objc-type> := <source-name> # PU<11+>objcproto 11objc_object<source-name>
- // 11objc_object -> id<source-name>
+ // <number of digits in k1> + k1 <objc-type> := <source-name> #
+ // PU<11+>objcproto 11objc_object<source-name> 11objc_object -> id<source-
+ // name>
bool ParseType() {
#ifdef DEBUG_FAILURES
@@ -1476,8 +1470,8 @@ private:
// ::= <unnamed-type-name>
bool ParseUnqualifiedName(NameState &name_state) {
- // Note that these are detected directly in ParseNestedName for
- // performance rather than switching on the same options twice
+ // Note that these are detected directly in ParseNestedName for performance
+ // rather than switching on the same options twice
char next = *m_read_ptr;
switch (next) {
case 'C':
@@ -1943,7 +1937,8 @@ private:
break;
}
- // Record a substitution candidate for all prefixes, but not the full name
+ // Record a substitution candidate for all prefixes, but not the full
+ // name
if (suppress_substitution)
suppress_substitution = false;
else
@@ -2247,9 +2242,9 @@ private:
if (next == 'E' || next == '\0' || next == '.')
return true;
- // Clang has a bad habit of making unique manglings by just sticking numbers
- // on the end of a symbol,
- // which is ambiguous with malformed source name manglings
+ // Clang has a bad habit of making unique manglings by just sticking
+ // numbers on the end of a symbol, which is ambiguous with malformed source
+ // name manglings
const char *before_clang_uniquing_test = m_read_ptr;
if (TryParseNumber()) {
if (*m_read_ptr == '\0')
OpenPOWER on IntegriCloud