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/Plugins/SymbolFile/DWARF/HashedNameToDIE.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/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp')
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp | 95 |
1 files changed, 43 insertions, 52 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp index 629ae8b0a6a..36211a08557 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp @@ -75,15 +75,14 @@ void DWARFMappedHash::ExtractClassOrStructDIEArray( die_tag == DW_TAG_structure_type) { if (die_info_array[i].type_flags & eTypeFlagClassIsImplementation) { if (return_implementation_only_if_available) { - // We found the one true definition for this class, so - // only return that + // We found the one true definition for this class, so only return + // that die_offsets.clear(); die_offsets.emplace_back(die_info_array[i].cu_offset, die_info_array[i].offset); return; } else { - // Put the one true definition as the first entry so it - // matches first + // Put the one true definition as the first entry so it matches first die_offsets.emplace(die_offsets.begin(), die_info_array[i].cu_offset, die_info_array[i].offset); } @@ -137,9 +136,8 @@ DWARFMappedHash::DIEInfo::DIEInfo(dw_offset_t c, dw_offset_t o, dw_tag_t t, DWARFMappedHash::Prologue::Prologue(dw_offset_t _die_base_offset) : die_base_offset(_die_base_offset), atoms(), atom_mask(0), min_hash_data_byte_size(0), hash_data_has_fixed_byte_size(true) { - // Define an array of DIE offsets by first defining an array, - // and then define the atom type for the array, in this case - // we have an array of DIE offsets + // Define an array of DIE offsets by first defining an array, and then define + // the atom type for the array, in this case we have an array of DIE offsets AppendAtom(eAtomTypeDIEOffset, DW_FORM_data4); } @@ -239,8 +237,7 @@ DWARFMappedHash::Prologue::Read(const lldb_private::DataExtractor &data, size_t DWARFMappedHash::Prologue::GetByteSize() const { // Add an extra count to the atoms size for the zero termination Atom that - // gets - // written to disk + // gets written to disk return sizeof(die_base_offset) + sizeof(uint32_t) + atoms.size() * sizeof(Atom); } @@ -384,13 +381,13 @@ DWARFMappedHash::MemoryTable::GetHashDataForName( pair.key = m_data.GetU32(hash_data_offset_ptr); pair.value.clear(); - // If the key is zero, this terminates our chain of HashData objects - // for this hash value. + // If the key is zero, this terminates our chain of HashData objects for this + // hash value. if (pair.key == 0) return eResultEndOfHashData; - // There definitely should be a string for this string offset, if - // there isn't, there is something wrong, return and error + // There definitely should be a string for this string offset, if there + // isn't, there is something wrong, return and error const char *strp_cstr = m_string_table.PeekCStr(pair.key); if (strp_cstr == NULL) { *hash_data_offset_ptr = UINT32_MAX; @@ -403,22 +400,21 @@ DWARFMappedHash::MemoryTable::GetHashDataForName( if (count > 0 && m_data.ValidOffsetForDataOfSize(*hash_data_offset_ptr, min_total_hash_data_size)) { - // We have at least one HashData entry, and we have enough - // data to parse at least "count" HashData entries. + // We have at least one HashData entry, and we have enough data to parse at + // least "count" HashData entries. // First make sure the entire C string matches... const bool match = name == strp_cstr; if (!match && m_header.header_data.HashDataHasFixedByteSize()) { - // If the string doesn't match and we have fixed size data, - // we can just add the total byte size of all HashData objects - // to the hash data offset and be done... + // If the string doesn't match and we have fixed size data, we can just + // add the total byte size of all HashData objects to the hash data + // offset and be done... *hash_data_offset_ptr += min_total_hash_data_size; } else { - // If the string does match, or we don't have fixed size data - // then we need to read the hash data as a stream. If the - // string matches we also append all HashData objects to the - // value array. + // If the string does match, or we don't have fixed size data then we + // need to read the hash data as a stream. If the string matches we also + // append all HashData objects to the value array. for (uint32_t i = 0; i < count; ++i) { DIEInfo die_info; if (m_header.Read(m_data, hash_data_offset_ptr, die_info)) { @@ -432,16 +428,15 @@ DWARFMappedHash::MemoryTable::GetHashDataForName( } } } - // Return the correct response depending on if the string matched - // or not... + // Return the correct response depending on if the string matched or not... if (match) return eResultKeyMatch; // The key (cstring) matches and we have lookup // results! else return eResultKeyMismatch; // The key doesn't match, this function will // get called - // again for the next key/value or the key terminator - // which in our case is a zero .debug_str offset. + // again for the next key/value or the key terminator which in our case is + // a zero .debug_str offset. } else { *hash_data_offset_ptr = UINT32_MAX; return eResultError; @@ -453,13 +448,13 @@ DWARFMappedHash::MemoryTable::AppendHashDataForRegularExpression( const lldb_private::RegularExpression ®ex, lldb::offset_t *hash_data_offset_ptr, Pair &pair) const { pair.key = m_data.GetU32(hash_data_offset_ptr); - // If the key is zero, this terminates our chain of HashData objects - // for this hash value. + // If the key is zero, this terminates our chain of HashData objects for this + // hash value. if (pair.key == 0) return eResultEndOfHashData; - // There definitely should be a string for this string offset, if - // there isn't, there is something wrong, return and error + // There definitely should be a string for this string offset, if there + // isn't, there is something wrong, return and error const char *strp_cstr = m_string_table.PeekCStr(pair.key); if (strp_cstr == NULL) return eResultError; @@ -473,15 +468,14 @@ DWARFMappedHash::MemoryTable::AppendHashDataForRegularExpression( const bool match = regex.Execute(llvm::StringRef(strp_cstr)); if (!match && m_header.header_data.HashDataHasFixedByteSize()) { - // If the regex doesn't match and we have fixed size data, - // we can just add the total byte size of all HashData objects - // to the hash data offset and be done... + // If the regex doesn't match and we have fixed size data, we can just + // add the total byte size of all HashData objects to the hash data + // offset and be done... *hash_data_offset_ptr += min_total_hash_data_size; } else { - // If the string does match, or we don't have fixed size data - // then we need to read the hash data as a stream. If the - // string matches we also append all HashData objects to the - // value array. + // If the string does match, or we don't have fixed size data then we + // need to read the hash data as a stream. If the string matches we also + // append all HashData objects to the value array. for (uint32_t i = 0; i < count; ++i) { DIEInfo die_info; if (m_header.Read(m_data, hash_data_offset_ptr, die_info)) { @@ -495,16 +489,15 @@ DWARFMappedHash::MemoryTable::AppendHashDataForRegularExpression( } } } - // Return the correct response depending on if the string matched - // or not... + // Return the correct response depending on if the string matched or not... if (match) return eResultKeyMatch; // The key (cstring) matches and we have lookup // results! else return eResultKeyMismatch; // The key doesn't match, this function will // get called - // again for the next key/value or the key terminator - // which in our case is a zero .debug_str offset. + // again for the next key/value or the key terminator which in our case is + // a zero .debug_str offset. } else { *hash_data_offset_ptr = UINT32_MAX; return eResultError; @@ -529,8 +522,7 @@ size_t DWARFMappedHash::MemoryTable::AppendAllDIEsThatMatchingRegex( switch (hash_result) { case eResultKeyMatch: case eResultKeyMismatch: - // Whether we matches or not, it doesn't matter, we - // keep looking. + // Whether we matches or not, it doesn't matter, we keep looking. break; case eResultEndOfHashData: @@ -553,8 +545,8 @@ size_t DWARFMappedHash::MemoryTable::AppendAllDIEsInRange( lldb::offset_t hash_data_offset = GetHashDataOffset(offset_idx); while (!done && hash_data_offset != UINT32_MAX) { KeyType key = m_data.GetU32(&hash_data_offset); - // If the key is zero, this terminates our chain of HashData objects - // for this hash value. + // If the key is zero, this terminates our chain of HashData objects for + // this hash value. if (key == 0) break; @@ -610,17 +602,16 @@ size_t DWARFMappedHash::MemoryTable::FindCompleteObjCClassByName( if (FindByName(name, die_info_array)) { if (must_be_implementation && GetHeader().header_data.ContainsAtom(eAtomTypeTypeFlags)) { - // If we have two atoms, then we have the DIE offset and - // the type flags so we can find the objective C class - // efficiently. + // If we have two atoms, then we have the DIE offset and the type flags + // so we can find the objective C class efficiently. DWARFMappedHash::ExtractTypesFromDIEArray(die_info_array, UINT32_MAX, eTypeFlagClassIsImplementation, die_offsets); } else { - // We don't only want the one true definition, so try and see - // what we can find, and only return class or struct DIEs. - // If we do have the full implementation, then return it alone, - // else return all possible matches. + // We don't only want the one true definition, so try and see what we can + // find, and only return class or struct DIEs. If we do have the full + // implementation, then return it alone, else return all possible + // matches. const bool return_implementation_only_if_available = true; DWARFMappedHash::ExtractClassOrStructDIEArray( die_info_array, return_implementation_only_if_available, die_offsets); |

