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/Symbol | |
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/Symbol')
25 files changed, 626 insertions, 759 deletions
diff --git a/lldb/source/Symbol/ArmUnwindInfo.cpp b/lldb/source/Symbol/ArmUnwindInfo.cpp index 4da307bf0c3..6dcad62f2f9 100644 --- a/lldb/source/Symbol/ArmUnwindInfo.cpp +++ b/lldb/source/Symbol/ArmUnwindInfo.cpp @@ -65,17 +65,16 @@ ArmUnwindInfo::ArmUnwindInfo(ObjectFile &objfile, SectionSP &arm_exidx, } // Sort the entries in the exidx section. The entries should be sorted inside - // the section but - // some old compiler isn't sorted them. + // the section but some old compiler isn't sorted them. std::sort(m_exidx_entries.begin(), m_exidx_entries.end()); } ArmUnwindInfo::~ArmUnwindInfo() {} -// Read a byte from the unwind instruction stream with the given offset. -// Custom function is required because have to red in order of significance -// within their containing -// word (most significant byte first) and in increasing word address order. +// Read a byte from the unwind instruction stream with the given offset. Custom +// function is required because have to red in order of significance within +// their containing word (most significant byte first) and in increasing word +// address order. uint8_t ArmUnwindInfo::GetByteAtOffset(const uint32_t *data, uint16_t offset) const { uint32_t value = data[offset / 4]; @@ -276,8 +275,8 @@ bool ArmUnwindInfo::GetUnwindPlan(Target &target, const Address &addr, return false; } else if ((byte1 & 0xff) == 0xc8) { // 11001000 sssscccc - // Pop VFP double precision registers D[16+ssss]-D[16+ssss+cccc] saved (as - // if) by FSTMFDD (see remarks d,e) + // Pop VFP double precision registers D[16+ssss]-D[16+ssss+cccc] saved + // (as if) by FSTMFDD (see remarks d,e) if (byte_offset >= byte_count) return false; diff --git a/lldb/source/Symbol/Block.cpp b/lldb/source/Symbol/Block.cpp index 648d8ee48bf..46f875fca77 100644 --- a/lldb/source/Symbol/Block.cpp +++ b/lldb/source/Symbol/Block.cpp @@ -60,8 +60,7 @@ void Block::Dump(Stream *s, addr_t base_addr, int32_t depth, if (depth < 0) { Block *parent = GetParent(); if (parent) { - // We have a depth that is less than zero, print our parent blocks - // first + // We have a depth that is less than zero, print our parent blocks first parent->Dump(s, base_addr, depth + 1, show_context); } } diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index 0c389444208..a4d5256fd6a 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -163,8 +163,8 @@ bool ClangASTContext::IsOperator(const char *name, #undef OPERATOR_PREFIX #undef OPERATOR_PREFIX_LENGTH - // This is an operator, set the overloaded operator kind to invalid - // in case this is a conversion operator... + // This is an operator, set the overloaded operator kind to invalid in case + // this is a conversion operator... op_kind = clang::NUM_OVERLOADED_OPERATORS; switch (post_op_name[0]) { @@ -375,9 +375,9 @@ ClangASTContext::ConvertAccessTypeToAccessSpecifier(AccessType access) { static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) { // FIXME: Cleanup per-file based stuff. - // Set some properties which depend solely on the input kind; it would be nice - // to move these to the language standard, and have the driver resolve the - // input kind + language standard. + // Set some properties which depend solely on the input kind; it would be + // nice to move these to the language standard, and have the driver resolve + // the input kind + language standard. if (IK.getLanguage() == InputKind::Asm) { Opts.AsmPreprocessor = 1; } else if (IK.isObjectiveC()) { @@ -440,8 +440,8 @@ static void ParseLangArgs(LangOptions &Opts, InputKind IK, const char *triple) { Opts.setValueVisibilityMode(DefaultVisibility); - // Mimicing gcc's behavior, trigraphs are only enabled if -trigraphs - // is specified, or -std is set to a conforming mode. + // Mimicing gcc's behavior, trigraphs are only enabled if -trigraphs is + // specified, or -std is set to a conforming mode. Opts.Trigraphs = !Opts.GNUMode; Opts.CharIsSigned = ArchSpec(triple).CharIsSignedByDefault(); Opts.OptimizeSize = 0; @@ -662,8 +662,8 @@ ASTContext *ClangASTContext::getASTContext() { m_ast_ap->getDiagnostics().setClient(getDiagnosticConsumer(), false); // This can be NULL if we don't know anything about the architecture or if - // the - // target for an architecture isn't enabled in the llvm/clang that we built + // the target for an architecture isn't enabled in the llvm/clang that we + // built TargetInfo *target_info = getTargetInfo(); if (target_info) m_ast_ap->InitBuiltinTypes(*target_info); @@ -1254,8 +1254,8 @@ CompilerType ClangASTContext::GetTypeForDecl(clang::NamedDecl *decl) { } CompilerType ClangASTContext::GetTypeForDecl(TagDecl *decl) { - // No need to call the getASTContext() accessor (which can create the AST - // if it isn't created yet, because we can't have created a decl in this + // No need to call the getASTContext() accessor (which can create the AST if + // it isn't created yet, because we can't have created a decl in this // AST if our AST didn't already exist... ASTContext *ast = &decl->getASTContext(); if (ast) @@ -1264,8 +1264,8 @@ CompilerType ClangASTContext::GetTypeForDecl(TagDecl *decl) { } CompilerType ClangASTContext::GetTypeForDecl(ObjCInterfaceDecl *decl) { - // No need to call the getASTContext() accessor (which can create the AST - // if it isn't created yet, because we can't have created a decl in this + // No need to call the getASTContext() accessor (which can create the AST if + // it isn't created yet, because we can't have created a decl in this // AST if our AST didn't already exist... ASTContext *ast = &decl->getASTContext(); if (ast) @@ -1294,9 +1294,9 @@ CompilerType ClangASTContext::CreateRecordType(DeclContext *decl_ctx, } // NOTE: Eventually CXXRecordDecl will be merged back into RecordDecl and - // we will need to update this code. I was told to currently always use - // the CXXRecordDecl class since we often don't know from debug information - // if something is struct or a class, so we default to always use the more + // we will need to update this code. I was told to currently always use the + // CXXRecordDecl class since we often don't know from debug information if + // something is struct or a class, so we default to always use the more // complete definition just in case. bool is_anonymous = (!name) || (!name[0]); @@ -1499,9 +1499,9 @@ ClangASTContext::CreateTemplateTemplateParmDecl(const char *template_name) { ast, template_param_infos, template_param_decls); // LLDB needs to create those decls only to be able to display a - // type that includes a template template argument. Only the name - // matters for this purpose, so we use dummy values for the other - // characterisitcs of the type. + // type that includes a template template argument. Only the name matters for + // this purpose, so we use dummy values for the other characterisitcs of the + // type. return TemplateTemplateParmDecl::Create( *ast, decl_ctx, SourceLocation(), /*Depth*/ 0, /*Position*/ 0, @@ -1933,11 +1933,10 @@ ClangASTContext::GetDeclarationName(const char *name, return DeclarationName(&getASTContext()->Idents.get( name)); // Not operator, but a regular function. - // Check the number of operator parameters. Sometimes we have - // seen bad DWARF that doesn't correctly describe operators and - // if we try to create a method and add it to the class, clang - // will assert and crash, so we need to make sure things are - // acceptable. + // Check the number of operator parameters. Sometimes we have seen bad DWARF + // that doesn't correctly describe operators and if we try to create a method + // and add it to the class, clang will assert and crash, so we need to make + // sure things are acceptable. clang::QualType method_qual_type(ClangUtil::GetQualType(function_clang_type)); const clang::FunctionProtoType *function_type = llvm::dyn_cast<clang::FunctionProtoType>(method_qual_type.getTypePtr()); @@ -2247,8 +2246,8 @@ bool ClangASTContext::DeclsAreEquivalent(clang::Decl *lhs_decl, if (lhs_decl_kind == rhs_decl_kind) { //------------------------------------------------------------------ - // Now check that the decl contexts kinds are all equivalent - // before we have to check any names of the decl contexts... + // Now check that the decl contexts kinds are all equivalent before we + // have to check any names of the decl contexts... //------------------------------------------------------------------ clang::DeclContext *lhs_decl_ctx = lhs_decl->getDeclContext(); clang::DeclContext *rhs_decl_ctx = rhs_decl->getDeclContext(); @@ -2290,8 +2289,8 @@ bool ClangASTContext::DeclsAreEquivalent(clang::Decl *lhs_decl, return false; //-------------------------------------------------------------- - // We know that the decl context kinds all match, so now we need - // to make sure the names match as well + // We know that the decl context kinds all match, so now we need to + // make sure the names match as well //-------------------------------------------------------------- lhs_decl_ctx = lhs_decl->getDeclContext(); rhs_decl_ctx = rhs_decl->getDeclContext(); @@ -2561,8 +2560,7 @@ static bool GetCompleteQualType(clang::ASTContext *ast, clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface(); // We currently can't complete objective C types through the newly added - // ASTContext - // because it only supports TagDecl objects right now... + // ASTContext because it only supports TagDecl objects right now... if (class_interface_decl) { if (class_interface_decl->getDefinition()) return true; @@ -2882,8 +2880,8 @@ bool ClangASTContext::IsCStringType(lldb::opaque_compiler_type_t type, if (type_flags.AnySet(eTypeIsArray | eTypeIsPointer)) { if (pointee_or_element_clang_type.IsCharType()) { if (type_flags.Test(eTypeIsArray)) { - // We know the size of the array and it could be a C string - // since it is an array of characters + // We know the size of the array and it could be a C string since it is + // an array of characters length = llvm::cast<clang::ConstantArrayType>( GetCanonicalQualType(type).getTypePtr()) ->getSize() @@ -3623,9 +3621,8 @@ bool ClangASTContext::IsPossibleDynamicType(lldb::opaque_compiler_type_t type, if (success) { // Check to make sure what we are pointing too is a possible dynamic C++ - // type - // We currently accept any "void *" (in case we have a class that has been - // watered down to an opaque pointer) and virtual C++ classes. + // type We currently accept any "void *" (in case we have a class that + // has been watered down to an opaque pointer) and virtual C++ classes. const clang::Type::TypeClass pointee_type_class = pointee_qual_type.getCanonicalType()->getTypeClass(); switch (pointee_type_class) { @@ -4777,9 +4774,8 @@ ClangASTContext::CreateTypedef(lldb::opaque_compiler_type_t type, } // Check whether this declaration is an anonymous struct, union, or enum, - // hidden behind a typedef. If so, we - // try to check whether we have a typedef tag to attach to the original - // record declaration + // hidden behind a typedef. If so, we try to check whether we have a + // typedef tag to attach to the original record declaration if (tdecl && !tdecl->getIdentifier() && !tdecl->getTypedefNameForAnonDecl()) tdecl->setTypedefNameForAnonDecl(decl); @@ -5005,9 +5001,8 @@ lldb::Encoding ClangASTContext::GetEncoding(lldb::opaque_compiler_type_t type, break; } break; - // All pointer types are represented as unsigned integer encodings. - // We may nee to add a eEncodingPointer if we ever need to know the - // difference + // All pointer types are represented as unsigned integer encodings. We may + // nee to add a eEncodingPointer if we ever need to know the difference case clang::Type::ObjCObjectPointer: case clang::Type::BlockPointer: case clang::Type::Pointer: @@ -5324,10 +5319,9 @@ uint32_t ClangASTContext::GetNumChildren(lldb::opaque_compiler_type_t type, llvm::dyn_cast<clang::CXXRecordDecl>(record_decl); if (cxx_record_decl) { if (omit_empty_base_classes) { - // Check each base classes to see if it or any of its - // base classes contain any fields. This can help - // limit the noise in variable views by not having to - // show base classes that contain no members. + // Check each base classes to see if it or any of its base classes + // contain any fields. This can help limit the noise in variable + // views by not having to show base classes that contain no members. clang::CXXRecordDecl::base_class_const_iterator base_class, base_class_end; for (base_class = cxx_record_decl->bases_begin(), @@ -5420,8 +5414,8 @@ uint32_t ClangASTContext::GetNumChildren(lldb::opaque_compiler_type_t type, CompilerType(getASTContext(), pointee_type) .GetNumChildren(omit_empty_base_classes); if (num_pointee_children == 0) { - // We have a pointer to a pointee type that claims it has no children. - // We will want to look at + // We have a pointer to a pointee type that claims it has no children. We + // will want to look at num_children = GetNumPointeeChildren(pointee_type); } else num_children = num_pointee_children; @@ -6615,15 +6609,12 @@ CompilerType ClangASTContext::GetChildCompilerTypeAtIndex( child_byte_size = ivar_type_info.Width / 8; // Figure out the field offset within the current - // struct/union/class type - // For ObjC objects, we can't trust the bit offset we get from - // the Clang AST, since - // that doesn't account for the space taken up by unbacked - // properties, or from - // the changing size of base classes that are newer than this - // class. - // So if we have a process around that we can ask about this - // object, do so. + // struct/union/class type For ObjC objects, we can't trust the + // bit offset we get from the Clang AST, since that doesn't + // account for the space taken up by unbacked properties, or + // from the changing size of base classes that are newer than + // this class. So if we have a process around that we can ask + // about this object, do so. child_byte_offset = LLDB_INVALID_IVAR_OFFSET; Process *process = nullptr; if (exe_ctx) @@ -6651,9 +6642,8 @@ CompilerType ClangASTContext::GetChildCompilerTypeAtIndex( } // Note, the ObjC Ivar Byte offset is just that, it doesn't - // account for the bit offset - // of a bitfield within its containing object. So regardless of - // where we get the byte + // account for the bit offset of a bitfield within its + // containing object. So regardless of where we get the byte // offset from, we still need to get the bit offset for // bitfields from the layout. @@ -6925,8 +6915,8 @@ static uint32_t GetIndexForRecordChild(const clang::RecordDecl *record_decl, } // Look for a child member (doesn't include base classes, but it does include -// their members) in the type hierarchy. Returns an index path into "clang_type" -// on how to reach the appropriate member. +// their members) in the type hierarchy. Returns an index path into +// "clang_type" on how to reach the appropriate member. // // class A // { @@ -6949,16 +6939,13 @@ static uint32_t GetIndexForRecordChild(const clang::RecordDecl *record_decl, // "m_b" in it: // // With omit_empty_base_classes == false we would get an integer array back -// with: -// { 1, 1 } -// The first index 1 is the child index for "class A" within class C -// The second index 1 is the child index for "m_b" within class A +// with: { 1, 1 } The first index 1 is the child index for "class A" within +// class C The second index 1 is the child index for "m_b" within class A // -// With omit_empty_base_classes == true we would get an integer array back with: -// { 0, 1 } -// The first index 0 is the child index for "class A" within class C (since -// class B doesn't have any members it doesn't count) -// The second index 1 is the child index for "m_b" within class A +// With omit_empty_base_classes == true we would get an integer array back +// with: { 0, 1 } The first index 0 is the child index for "class A" within +// class C (since class B doesn't have any members it doesn't count) The second +// index 1 is the child index for "m_b" within class A size_t ClangASTContext::GetIndexOfChildMemberWithName( lldb::opaque_compiler_type_t type, const char *name, @@ -7093,9 +7080,9 @@ size_t ClangASTContext::GetIndexOfChildMemberWithName( } if (superclass_interface_decl) { - // The super class index is always zero for ObjC classes, - // so we push it onto the child indexes in case we find - // an ivar in our superclass... + // The super class index is always zero for ObjC classes, so we + // push it onto the child indexes in case we find an ivar in our + // superclass... child_indexes.push_back(0); CompilerType superclass_clang_type( @@ -7103,14 +7090,13 @@ size_t ClangASTContext::GetIndexOfChildMemberWithName( superclass_interface_decl)); if (superclass_clang_type.GetIndexOfChildMemberWithName( name, omit_empty_base_classes, child_indexes)) { - // We did find an ivar in a superclass so just - // return the results! + // We did find an ivar in a superclass so just return the + // results! return child_indexes.size(); } - // We didn't find an ivar matching "name" in our - // superclass, pop the superclass zero index that - // we pushed on above. + // We didn't find an ivar matching "name" in our superclass, pop + // the superclass zero index that we pushed on above. child_indexes.pop_back(); } } @@ -7703,8 +7689,8 @@ clang::FieldDecl *ClangASTContext::AddFieldToRecordType( clang::ICIS_NoInit); // HasInit if (!name) { - // Determine whether this field corresponds to an anonymous - // struct or union. + // Determine whether this field corresponds to an anonymous struct or + // union. if (const clang::TagType *TagT = field->getType()->getAs<clang::TagType>()) { if (clang::RecordDecl *Rec = @@ -7848,8 +7834,8 @@ void ClangASTContext::BuildIndirectFields(const CompilerType &type) { } } - // Check the last field to see if it has an incomplete array type as its - // last member and if it does, the tell the record decl about it + // Check the last field to see if it has an incomplete array type as its last + // member and if it does, the tell the record decl about it if (last_field_pos != field_end_pos) { if (last_field_pos->getType()->isIncompleteArrayType()) record_decl->hasFlexibleArrayMember(); @@ -7983,11 +7969,10 @@ clang::CXXMethodDecl *ClangASTContext::AddMethodToCXXRecordType( if (IsOperator(name, op_kind)) { if (op_kind != clang::NUM_OVERLOADED_OPERATORS) { - // Check the number of operator parameters. Sometimes we have - // seen bad DWARF that doesn't correctly describe operators and - // if we try to create a method and add it to the class, clang - // will assert and crash, so we need to make sure things are - // acceptable. + // Check the number of operator parameters. Sometimes we have seen bad + // DWARF that doesn't correctly describe operators and if we try to + // create a method and add it to the class, clang will assert and + // crash, so we need to make sure things are acceptable. const bool is_method = true; if (!ClangASTContext::CheckOverloadedOperatorKindParameterCount( is_method, op_kind, num_params)) @@ -8667,8 +8652,8 @@ bool ClangASTContext::CompleteTagDeclarationDefinition( clang::QualType qual_type(ClangUtil::GetQualType(type)); if (!qual_type.isNull()) { // Make sure we use the same methodology as - // ClangASTContext::StartTagDeclarationDefinition() - // as to how we start/end the definition. Previously we were calling + // ClangASTContext::StartTagDeclarationDefinition() as to how we start/end + // the definition. Previously we were calling const clang::TagType *tag_type = qual_type->getAs<clang::TagType>(); if (tag_type) { clang::TagDecl *tag_decl = tag_type->getDecl(); @@ -8938,9 +8923,8 @@ void ClangASTContext::DumpValue( for (field = record_decl->field_begin(), field_end = record_decl->field_end(); field != field_end; ++field, ++field_idx, ++child_idx) { - // Print the starting squiggly bracket (if this is the - // first member) or comma (for member 2 and beyond) for - // the struct/union/class member. + // Print the starting squiggly bracket (if this is the first member) or + // comma (for member 2 and beyond) for the struct/union/class member. if (child_idx == 0) s->PutChar('{'); else @@ -8951,8 +8935,8 @@ void ClangASTContext::DumpValue( clang::QualType field_type = field->getType(); // Print the member type if requested - // Figure out the type byte size (field_type_info.first) and - // alignment (field_type_info.second) from the AST context. + // Figure out the type byte size (field_type_info.first) and alignment + // (field_type_info.second) from the AST context. clang::TypeInfo field_type_info = getASTContext()->getTypeInfo(field_type); assert(field_idx < record_layout.getFieldCount()); @@ -9023,8 +9007,8 @@ void ClangASTContext::DumpValue( return; } } - // If we have gotten here we didn't get find the enumerator in the - // enum decl, so just print the integer. + // If we have gotten here we didn't get find the enumerator in the enum + // decl, so just print the integer. s->Printf("%" PRIi64, enum_value); } return; @@ -9062,9 +9046,8 @@ void ClangASTContext::DumpValue( lldb::Format element_format = element_clang_type.GetFormat(); for (element_idx = 0; element_idx < element_count; ++element_idx) { - // Print the starting squiggly bracket (if this is the - // first member) or comman (for member 2 and beyong) for - // the struct/union/class member. + // Print the starting squiggly bracket (if this is the first member) or + // comman (for member 2 and beyong) for the struct/union/class member. if (element_idx == 0) s->PutChar('{'); else @@ -9260,8 +9243,8 @@ bool ClangASTContext::DumpTypeValue( } break; case clang::Type::Enum: - // If our format is enum or default, show the enumeration value as - // its enumeration string value, else just display it as requested. + // If our format is enum or default, show the enumeration value as its + // enumeration string value, else just display it as requested. if ((format == eFormatEnum || format == eFormatDefault) && GetCompleteType(type)) { const clang::EnumType *enutype = @@ -9553,9 +9536,9 @@ void ClangASTContext::DumpTypeName(const CompilerType &type) { if (objc_class_type) { clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface(); - // We currently can't complete objective C types through the newly added - // ASTContext - // because it only supports TagDecl objects right now... + // We currently can't complete objective C types through the newly + // added ASTContext because it only supports TagDecl objects right + // now... if (class_interface_decl) printf("@class %s", class_interface_decl->getName().str().c_str()); } @@ -9813,15 +9796,12 @@ std::vector<CompilerDecl> ClangASTContext::DeclContextFindDeclByName( // Look for child_decl_ctx's lookup scope in frame_decl_ctx and its parents, // and return the number of levels it took to find it, or -// LLDB_INVALID_DECL_LEVEL -// if not found. If the decl was imported via a using declaration, its name -// and/or -// type, if set, will be used to check that the decl found in the scope is a -// match. +// LLDB_INVALID_DECL_LEVEL if not found. If the decl was imported via a using +// declaration, its name and/or type, if set, will be used to check that the +// decl found in the scope is a match. // // The optional name is required by languages (like C++) to handle using -// declarations -// like: +// declarations like: // // void poo(); // namespace ns { @@ -9850,14 +9830,10 @@ std::vector<CompilerDecl> ClangASTContext::DeclContextFindDeclByName( // // NOTE: Because file statics are at the TranslationUnit along with globals, a // function at file scope will return the same level as a function at global -// scope. -// Ideally we'd like to treat the file scope as an additional scope just below -// the -// global scope. More work needs to be done to recognise that, if the decl -// we're -// trying to look up is static, we should compare its source file with that of -// the -// current scope and return a lower number for it. +// scope. Ideally we'd like to treat the file scope as an additional scope just +// below the global scope. More work needs to be done to recognise that, if +// the decl we're trying to look up is static, we should compare its source +// file with that of the current scope and return a lower number for it. uint32_t ClangASTContext::CountDeclLevels(clang::DeclContext *frame_decl_ctx, clang::DeclContext *child_decl_ctx, ConstString *child_name, @@ -9886,10 +9862,8 @@ uint32_t ClangASTContext::CountDeclLevels(clang::DeclContext *frame_decl_ctx, continue; // Currently DWARF has one shared translation unit for all Decls at top - // level, so this - // would erroneously find using statements anywhere. So don't look at - // the top-level - // translation unit. + // level, so this would erroneously find using statements anywhere. So + // don't look at the top-level translation unit. // TODO fix this and add a testcase that depends on it. if (llvm::isa<clang::TranslationUnitDecl>(it->second)) diff --git a/lldb/source/Symbol/ClangASTImporter.cpp b/lldb/source/Symbol/ClangASTImporter.cpp index 72ccaed43ea..ea3b141c9e7 100644 --- a/lldb/source/Symbol/ClangASTImporter.cpp +++ b/lldb/source/Symbol/ClangASTImporter.cpp @@ -354,8 +354,7 @@ bool ClangASTImporter::CanImport(const CompilerType &type) { clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface(); // We currently can't complete objective C types through the newly added - // ASTContext - // because it only supports TagDecl objects right now... + // ASTContext because it only supports TagDecl objects right now... if (class_interface_decl) { if (ResolveDeclOrigin(class_interface_decl, NULL, NULL)) return true; @@ -431,8 +430,7 @@ bool ClangASTImporter::Import(const CompilerType &type) { clang::ObjCInterfaceDecl *class_interface_decl = objc_class_type->getInterface(); // We currently can't complete objective C types through the newly added - // ASTContext - // because it only supports TagDecl objects right now... + // ASTContext because it only supports TagDecl objects right now... if (class_interface_decl) { if (ResolveDeclOrigin(class_interface_decl, NULL, NULL)) return CompleteAndFetchChildren(qual_type); @@ -896,9 +894,9 @@ void ClangASTImporter::Minion::ImportDefinitionTo(clang::Decl *to, } } - // If we're dealing with an Objective-C class, ensure that the inheritance has - // been set up correctly. The ASTImporter may not do this correctly if the - // class was originally sourced from symbols. + // If we're dealing with an Objective-C class, ensure that the inheritance + // has been set up correctly. The ASTImporter may not do this correctly if + // the class was originally sourced from symbols. if (ObjCInterfaceDecl *to_objc_interface = dyn_cast<ObjCInterfaceDecl>(to)) { do { diff --git a/lldb/source/Symbol/CompactUnwindInfo.cpp b/lldb/source/Symbol/CompactUnwindInfo.cpp index df71b17c09d..7dda877582c 100644 --- a/lldb/source/Symbol/CompactUnwindInfo.cpp +++ b/lldb/source/Symbol/CompactUnwindInfo.cpp @@ -262,8 +262,7 @@ void CompactUnwindInfo::ScanIndex(const ProcessSP &process_sp) { if (m_unwindinfo_data_computed == false) { if (m_section_sp->IsEncrypted()) { // Can't get section contents of a protected/encrypted section until we - // have a live - // process and can read them out of memory. + // have a live process and can read them out of memory. if (process_sp.get() == nullptr) return; m_section_contents_if_encrypted.reset( @@ -329,11 +328,10 @@ void CompactUnwindInfo::ScanIndex(const ProcessSP &process_sp) { return; } - // Parse the basic information from the indexes - // We wait to scan the second level page info until it's needed + // Parse the basic information from the indexes We wait to scan the second + // level page info until it's needed - // struct unwind_info_section_header_index_entry - // { + // struct unwind_info_section_header_index_entry { // uint32_t functionOffset; // uint32_t secondLevelPagesSectionOffset; // uint32_t lsdaIndexArraySectionOffset; @@ -388,8 +386,7 @@ void CompactUnwindInfo::ScanIndex(const ProcessSP &process_sp) { uint32_t CompactUnwindInfo::GetLSDAForFunctionOffset(uint32_t lsda_offset, uint32_t lsda_count, uint32_t function_offset) { - // struct unwind_info_section_header_lsda_index_entry - // { + // struct unwind_info_section_header_lsda_index_entry { // uint32_t functionOffset; // uint32_t lsdaOffset; // }; @@ -419,8 +416,7 @@ lldb::offset_t CompactUnwindInfo::BinarySearchRegularSecondPage( uint32_t entry_page_offset, uint32_t entry_count, uint32_t function_offset, uint32_t *entry_func_start_offset, uint32_t *entry_func_end_offset) { // typedef uint32_t compact_unwind_encoding_t; - // struct unwind_info_regular_second_level_entry - // { + // struct unwind_info_regular_second_level_entry { // uint32_t functionOffset; // compact_unwind_encoding_t encoding; @@ -539,9 +535,9 @@ bool CompactUnwindInfo::GetCompactUnwindInfoForFunction( auto next_it = it + 1; if (next_it != m_indexes.end()) { - // initialize the function offset end range to be the start of the - // next index offset. If we find an entry which is at the end of - // the index table, this will establish the range end. + // initialize the function offset end range to be the start of the next + // index offset. If we find an entry which is at the end of the index + // table, this will establish the range end. unwind_info.valid_range_offset_end = next_it->function_offset; } @@ -554,15 +550,13 @@ bool CompactUnwindInfo::GetCompactUnwindInfoForFunction( &offset); // UNWIND_SECOND_LEVEL_REGULAR or UNWIND_SECOND_LEVEL_COMPRESSED if (kind == UNWIND_SECOND_LEVEL_REGULAR) { - // struct unwind_info_regular_second_level_page_header - // { + // struct unwind_info_regular_second_level_page_header { // uint32_t kind; // UNWIND_SECOND_LEVEL_REGULAR // uint16_t entryPageOffset; // uint16_t entryCount; // typedef uint32_t compact_unwind_encoding_t; - // struct unwind_info_regular_second_level_entry - // { + // struct unwind_info_regular_second_level_entry { // uint32_t functionOffset; // compact_unwind_encoding_t encoding; @@ -612,8 +606,7 @@ bool CompactUnwindInfo::GetCompactUnwindInfoForFunction( } return true; } else if (kind == UNWIND_SECOND_LEVEL_COMPRESSED) { - // struct unwind_info_compressed_second_level_page_header - // { + // struct unwind_info_compressed_second_level_page_header { // uint32_t kind; // UNWIND_SECOND_LEVEL_COMPRESSED // uint16_t entryPageOffset; // offset from this 2nd lvl page // idx to array of entries @@ -721,8 +714,8 @@ enum x86_64_eh_regnum { // enough }; -// Convert the compact_unwind_info.h register numbering scheme -// to eRegisterKindEHFrame (eh_frame) register numbering scheme. +// Convert the compact_unwind_info.h register numbering scheme to +// eRegisterKindEHFrame (eh_frame) register numbering scheme. uint32_t translate_to_eh_frame_regnum_x86_64(uint32_t unwind_regno) { switch (unwind_regno) { case UNWIND_X86_64_REG_RBX: @@ -802,9 +795,8 @@ bool CompactUnwindInfo::CreateUnwindPlan_x86_64(Target &target, case UNWIND_X86_64_MODE_STACK_IND: { // The clang in Xcode 6 is emitting incorrect compact unwind encodings for - // this - // style of unwind. It was fixed in llvm r217020. - // The clang in Xcode 7 has this fixed. + // this style of unwind. It was fixed in llvm r217020. The clang in Xcode + // 7 has this fixed. return false; } break; @@ -861,17 +853,17 @@ bool CompactUnwindInfo::CreateUnwindPlan_x86_64(Target &target, if (register_count > 0) { - // We need to include (up to) 6 registers in 10 bits. - // That would be 18 bits if we just used 3 bits per reg to indicate - // the order they're saved on the stack. + // We need to include (up to) 6 registers in 10 bits. That would be 18 + // bits if we just used 3 bits per reg to indicate the order they're + // saved on the stack. // // This is done with Lehmer code permutation, e.g. see - // http://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms + // http://stackoverflow.com/questions/1506078/fast-permutation-number- + // permutation-mapping-algorithms int permunreg[6] = {0, 0, 0, 0, 0, 0}; - // This decodes the variable-base number in the 10 bits - // and gives us the Lehmer code sequence which can then - // be decoded. + // This decodes the variable-base number in the 10 bits and gives us the + // Lehmer code sequence which can then be decoded. switch (register_count) { case 6: @@ -923,8 +915,8 @@ bool CompactUnwindInfo::CreateUnwindPlan_x86_64(Target &target, break; } - // Decode the Lehmer code for this permutation of - // the registers v. http://en.wikipedia.org/wiki/Lehmer_code + // Decode the Lehmer code for this permutation of the registers v. + // http://en.wikipedia.org/wiki/Lehmer_code int registers[6] = {UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE, UNWIND_X86_64_REG_NONE, @@ -993,8 +985,8 @@ enum i386_eh_regnum { // enough }; -// Convert the compact_unwind_info.h register numbering scheme -// to eRegisterKindEHFrame (eh_frame) register numbering scheme. +// Convert the compact_unwind_info.h register numbering scheme to +// eRegisterKindEHFrame (eh_frame) register numbering scheme. uint32_t translate_to_eh_frame_regnum_i386(uint32_t unwind_regno) { switch (unwind_regno) { case UNWIND_X86_REG_EBX: @@ -1123,17 +1115,17 @@ bool CompactUnwindInfo::CreateUnwindPlan_i386(Target &target, if (register_count > 0) { - // We need to include (up to) 6 registers in 10 bits. - // That would be 18 bits if we just used 3 bits per reg to indicate - // the order they're saved on the stack. + // We need to include (up to) 6 registers in 10 bits. That would be 18 + // bits if we just used 3 bits per reg to indicate the order they're + // saved on the stack. // // This is done with Lehmer code permutation, e.g. see - // http://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms + // http://stackoverflow.com/questions/1506078/fast-permutation-number- + // permutation-mapping-algorithms int permunreg[6] = {0, 0, 0, 0, 0, 0}; - // This decodes the variable-base number in the 10 bits - // and gives us the Lehmer code sequence which can then - // be decoded. + // This decodes the variable-base number in the 10 bits and gives us the + // Lehmer code sequence which can then be decoded. switch (register_count) { case 6: @@ -1185,8 +1177,8 @@ bool CompactUnwindInfo::CreateUnwindPlan_i386(Target &target, break; } - // Decode the Lehmer code for this permutation of - // the registers v. http://en.wikipedia.org/wiki/Lehmer_code + // Decode the Lehmer code for this permutation of the registers v. + // http://en.wikipedia.org/wiki/Lehmer_code int registers[6] = {UNWIND_X86_REG_NONE, UNWIND_X86_REG_NONE, UNWIND_X86_REG_NONE, UNWIND_X86_REG_NONE, @@ -1260,14 +1252,10 @@ enum arm64_eh_regnum { pc = 32, // Compact unwind encodes d8-d15 but we don't have eh_frame / dwarf reg #'s - // for the 64-bit - // fp regs. Normally in DWARF it's context sensitive - so it knows it is - // fetching a - // 32- or 64-bit quantity from reg v8 to indicate s0 or d0 - but the unwinder - // is operating - // at a lower level and we'd try to fetch 128 bits if we were told that v8 - // were stored on - // the stack... + // for the 64-bit fp regs. Normally in DWARF it's context sensitive - so it + // knows it is fetching a 32- or 64-bit quantity from reg v8 to indicate s0 + // or d0 - but the unwinder is operating at a lower level and we'd try to + // fetch 128 bits if we were told that v8 were stored on the stack... v8 = 72, v9 = 73, v10 = 74, diff --git a/lldb/source/Symbol/CompileUnit.cpp b/lldb/source/Symbol/CompileUnit.cpp index f0bbeab6011..a4f0d4231e2 100644 --- a/lldb/source/Symbol/CompileUnit.cpp +++ b/lldb/source/Symbol/CompileUnit.cpp @@ -67,10 +67,10 @@ void CompileUnit::GetDescription(Stream *s, } //---------------------------------------------------------------------- -// Dump the current contents of this object. No functions that cause on -// demand parsing of functions, globals, statics are called, so this -// is a good function to call to get an idea of the current contents of -// the CompileUnit object. +// Dump the current contents of this object. No functions that cause on demand +// parsing of functions, globals, statics are called, so this is a good +// function to call to get an idea of the current contents of the CompileUnit +// object. //---------------------------------------------------------------------- void CompileUnit::Dump(Stream *s, bool show_context) const { const char *language = Language::GetNameForLanguageType(m_language); @@ -118,28 +118,27 @@ FunctionSP CompileUnit::GetFunctionAtIndex(size_t idx) { } //---------------------------------------------------------------------- -// Find functions using the Mangled::Tokens token list. This -// function currently implements an interactive approach designed to find -// all instances of certain functions. It isn't designed to the -// quickest way to lookup functions as it will need to iterate through -// all functions and see if they match, though it does provide a powerful -// and context sensitive way to search for all functions with a certain -// name, all functions in a namespace, or all functions of a template -// type. See Mangled::Tokens::Parse() comments for more information. +// Find functions using the Mangled::Tokens token list. This function currently +// implements an interactive approach designed to find all instances of certain +// functions. It isn't designed to the quickest way to lookup functions as it +// will need to iterate through all functions and see if they match, though it +// does provide a powerful and context sensitive way to search for all +// functions with a certain name, all functions in a namespace, or all +// functions of a template type. See Mangled::Tokens::Parse() comments for more +// information. // -// The function prototype will need to change to return a list of -// results. It was originally used to help debug the Mangled class -// and the Mangled::Tokens::MatchesQuery() function and it currently -// will print out a list of matching results for the functions that -// are currently in this compile unit. +// The function prototype will need to change to return a list of results. It +// was originally used to help debug the Mangled class and the +// Mangled::Tokens::MatchesQuery() function and it currently will print out a +// list of matching results for the functions that are currently in this +// compile unit. // // A FindFunctions method should be called prior to this that takes -// a regular function name (const char * or ConstString as a parameter) -// before resorting to this slower but more complete function. The -// other FindFunctions method should be able to take advantage of any -// accelerator tables available in the debug information (which is -// parsed by the SymbolFile parser plug-ins and registered with each -// Module). +// a regular function name (const char * or ConstString as a parameter) before +// resorting to this slower but more complete function. The other FindFunctions +// method should be able to take advantage of any accelerator tables available +// in the debug information (which is parsed by the SymbolFile parser plug-ins +// and registered with each Module). //---------------------------------------------------------------------- // void // CompileUnit::FindFunctions(const Mangled::Tokens& tokens) @@ -283,8 +282,8 @@ uint32_t CompileUnit::ResolveSymbolContext(const FileSpec &file_spec, bool exact, uint32_t resolve_scope, SymbolContextList &sc_list) { // First find all of the file indexes that match our "file_spec". If - // "file_spec" has an empty directory, then only compare the basenames - // when finding file indexes + // "file_spec" has an empty directory, then only compare the basenames when + // finding file indexes std::vector<uint32_t> file_indexes; const bool full_match = (bool)file_spec.GetDirectory(); bool file_spec_matches_cu_file_spec = @@ -319,23 +318,23 @@ uint32_t CompileUnit::ResolveSymbolContext(const FileSpec &file_spec, uint32_t line_idx; if (num_file_indexes == 1) { - // We only have a single support file that matches, so use - // the line table function that searches for a line entries - // that match a single support file index + // We only have a single support file that matches, so use the line + // table function that searches for a line entries that match a single + // support file index LineEntry line_entry; line_idx = line_table->FindLineEntryIndexByFileIndex( 0, file_indexes.front(), line, exact, &line_entry); - // If "exact == true", then "found_line" will be the same - // as "line". If "exact == false", the "found_line" will be the - // closest line entry with a line number greater than "line" and - // we will use this for our subsequent line exact matches below. + // If "exact == true", then "found_line" will be the same as "line". If + // "exact == false", the "found_line" will be the closest line entry + // with a line number greater than "line" and we will use this for our + // subsequent line exact matches below. found_line = line_entry.line; while (line_idx != UINT32_MAX) { - // If they only asked for the line entry, then we're done, we can just - // copy that over. - // But if they wanted more than just the line number, fill it in. + // If they only asked for the line entry, then we're done, we can + // just copy that over. But if they wanted more than just the line + // number, fill it in. if (resolve_scope == eSymbolContextLineEntry) { sc.line_entry = line_entry; } else { @@ -349,17 +348,17 @@ uint32_t CompileUnit::ResolveSymbolContext(const FileSpec &file_spec, &line_entry); } } else { - // We found multiple support files that match "file_spec" so use - // the line table function that searches for a line entries - // that match a multiple support file indexes. + // We found multiple support files that match "file_spec" so use the + // line table function that searches for a line entries that match a + // multiple support file indexes. LineEntry line_entry; line_idx = line_table->FindLineEntryIndexByFileIndex( 0, file_indexes, line, exact, &line_entry); - // If "exact == true", then "found_line" will be the same - // as "line". If "exact == false", the "found_line" will be the - // closest line entry with a line number greater than "line" and - // we will use this for our subsequent line exact matches below. + // If "exact == true", then "found_line" will be the same as "line". If + // "exact == false", the "found_line" will be the closest line entry + // with a line number greater than "line" and we will use this for our + // subsequent line exact matches below. found_line = line_entry.line; while (line_idx != UINT32_MAX) { @@ -377,8 +376,8 @@ uint32_t CompileUnit::ResolveSymbolContext(const FileSpec &file_spec, } } } else if (file_spec_matches_cu_file_spec && !check_inlines) { - // only append the context if we aren't looking for inline call sites - // by file and line and if the file spec matches that of the compile unit + // only append the context if we aren't looking for inline call sites by + // file and line and if the file spec matches that of the compile unit sc_list.Append(sc); } return sc_list.GetSize() - prev_size; diff --git a/lldb/source/Symbol/CompilerType.cpp b/lldb/source/Symbol/CompilerType.cpp index 5d845361b03..2dd1d3ebd04 100644 --- a/lldb/source/Symbol/CompilerType.cpp +++ b/lldb/source/Symbol/CompilerType.cpp @@ -638,8 +638,8 @@ CompilerType CompilerType::GetChildCompilerTypeAtIndex( } // Look for a child member (doesn't include base classes, but it does include -// their members) in the type hierarchy. Returns an index path into "clang_type" -// on how to reach the appropriate member. +// their members) in the type hierarchy. Returns an index path into +// "clang_type" on how to reach the appropriate member. // // class A // { @@ -662,16 +662,13 @@ CompilerType CompilerType::GetChildCompilerTypeAtIndex( // "m_b" in it: // // With omit_empty_base_classes == false we would get an integer array back -// with: -// { 1, 1 } -// The first index 1 is the child index for "class A" within class C -// The second index 1 is the child index for "m_b" within class A +// with: { 1, 1 } The first index 1 is the child index for "class A" within +// class C The second index 1 is the child index for "m_b" within class A // -// With omit_empty_base_classes == true we would get an integer array back with: -// { 0, 1 } -// The first index 0 is the child index for "class A" within class C (since -// class B doesn't have any members it doesn't count) -// The second index 1 is the child index for "m_b" within class A +// With omit_empty_base_classes == true we would get an integer array back +// with: { 0, 1 } The first index 0 is the child index for "class A" within +// class C (since class B doesn't have any members it doesn't count) The second +// index 1 is the child index for "m_b" within class A size_t CompilerType::GetIndexOfChildMemberWithName( const char *name, bool omit_empty_base_classes, @@ -987,8 +984,8 @@ bool CompilerType::ReadFromMemory(lldb_private::ExecutionContext *exe_ctx, if (!IsValid()) return false; - // Can't convert a file address to anything valid without more - // context (which Module it came from) + // Can't convert a file address to anything valid without more context (which + // Module it came from) if (address_type == eAddressTypeFile) return false; @@ -1029,8 +1026,8 @@ bool CompilerType::WriteToMemory(lldb_private::ExecutionContext *exe_ctx, if (!IsValid()) return false; - // Can't convert a file address to anything valid without more - // context (which Module it came from) + // Can't convert a file address to anything valid without more context (which + // Module it came from) if (address_type == eAddressTypeFile) return false; diff --git a/lldb/source/Symbol/DWARFCallFrameInfo.cpp b/lldb/source/Symbol/DWARFCallFrameInfo.cpp index 572648d05f0..1bf9ff99e01 100644 --- a/lldb/source/Symbol/DWARFCallFrameInfo.cpp +++ b/lldb/source/Symbol/DWARFCallFrameInfo.cpp @@ -27,8 +27,8 @@ using namespace lldb_private; //---------------------------------------------------------------------- // GetDwarfEHPtr // -// Used for calls when the value type is specified by a DWARF EH Frame -// pointer encoding. +// Used for calls when the value type is specified by a DWARF EH Frame pointer +// encoding. //---------------------------------------------------------------------- static uint64_t GetGNUEHPointer(const DataExtractor &DE, offset_t *offset_ptr, @@ -83,8 +83,8 @@ GetGNUEHPointer(const DataExtractor &DE, offset_t *offset_ptr, break; case DW_EH_PE_aligned: { - // SetPointerSize should be called prior to extracting these so the - // pointer size is cached + // SetPointerSize should be called prior to extracting these so the pointer + // size is cached assert(addr_size != 0); if (addr_size) { // Align to a address size boundary first @@ -154,8 +154,8 @@ DWARFCallFrameInfo::DWARFCallFrameInfo(ObjectFile &objfile, bool DWARFCallFrameInfo::GetUnwindPlan(Address addr, UnwindPlan &unwind_plan) { FDEEntryMap::Entry fde_entry; - // Make sure that the Address we're searching for is the same object file - // as this DWARFCallFrameInfo, we only store File offsets in m_fde_index. + // Make sure that the Address we're searching for is the same object file as + // this DWARFCallFrameInfo, we only store File offsets in m_fde_index. ModuleSP module_sp = addr.GetModule(); if (module_sp.get() == nullptr || module_sp->GetObjectFile() == nullptr || module_sp->GetObjectFile() != &m_objfile) @@ -168,8 +168,8 @@ bool DWARFCallFrameInfo::GetUnwindPlan(Address addr, UnwindPlan &unwind_plan) { bool DWARFCallFrameInfo::GetAddressRange(Address addr, AddressRange &range) { - // Make sure that the Address we're searching for is the same object file - // as this DWARFCallFrameInfo, we only store File offsets in m_fde_index. + // Make sure that the Address we're searching for is the same object file as + // this DWARFCallFrameInfo, we only store File offsets in m_fde_index. ModuleSP module_sp = addr.GetModule(); if (module_sp.get() == nullptr || module_sp->GetObjectFile() == nullptr || module_sp->GetObjectFile() != &m_objfile) @@ -291,8 +291,8 @@ DWARFCallFrameInfo::ParseCIE(const dw_offset_t cie_offset) { return nullptr; } - // m_cfi_data uses address size from target architecture of the process - // may ignore these fields? + // m_cfi_data uses address size from target architecture of the process may + // ignore these fields? if (m_type == DWARF && cie_sp->version >= CFI_VERSION4) { cie_sp->address_size = m_cfi_data.GetU8(&offset); cie_sp->segment_size = m_cfi_data.GetU8(&offset); @@ -307,15 +307,15 @@ DWARFCallFrameInfo::ParseCIE(const dw_offset_t cie_offset) { : m_cfi_data.GetU8(&offset); if (cie_sp->augmentation[0]) { - // Get the length of the eh_frame augmentation data - // which starts with a ULEB128 length in bytes + // Get the length of the eh_frame augmentation data which starts with a + // ULEB128 length in bytes const size_t aug_data_len = (size_t)m_cfi_data.GetULEB128(&offset); const size_t aug_data_end = offset + aug_data_len; const size_t aug_str_len = strlen(cie_sp->augmentation); // A 'z' may be present as the first character of the string. - // If present, the Augmentation Data field shall be present. - // The contents of the Augmentation Data shall be interpreted - // according to other characters in the Augmentation String. + // If present, the Augmentation Data field shall be present. The contents + // of the Augmentation Data shall be interpreted according to other + // characters in the Augmentation String. if (cie_sp->augmentation[0] == 'z') { // Extract the Augmentation Data size_t aug_str_idx = 0; @@ -323,31 +323,27 @@ DWARFCallFrameInfo::ParseCIE(const dw_offset_t cie_offset) { char aug = cie_sp->augmentation[aug_str_idx]; switch (aug) { case 'L': - // Indicates the presence of one argument in the - // Augmentation Data of the CIE, and a corresponding - // argument in the Augmentation Data of the FDE. The - // argument in the Augmentation Data of the CIE is - // 1-byte and represents the pointer encoding used - // for the argument in the Augmentation Data of the - // FDE, which is the address of a language-specific - // data area (LSDA). The size of the LSDA pointer is - // specified by the pointer encoding used. + // Indicates the presence of one argument in the Augmentation Data + // of the CIE, and a corresponding argument in the Augmentation + // Data of the FDE. The argument in the Augmentation Data of the + // CIE is 1-byte and represents the pointer encoding used for the + // argument in the Augmentation Data of the FDE, which is the + // address of a language-specific data area (LSDA). The size of the + // LSDA pointer is specified by the pointer encoding used. cie_sp->lsda_addr_encoding = m_cfi_data.GetU8(&offset); break; case 'P': - // Indicates the presence of two arguments in the - // Augmentation Data of the CIE. The first argument - // is 1-byte and represents the pointer encoding - // used for the second argument, which is the - // address of a personality routine handler. The - // size of the personality routine pointer is - // specified by the pointer encoding used. + // Indicates the presence of two arguments in the Augmentation Data + // of the CIE. The first argument is 1-byte and represents the + // pointer encoding used for the second argument, which is the + // address of a personality routine handler. The size of the + // personality routine pointer is specified by the pointer encoding + // used. // - // The address of the personality function will - // be stored at this location. Pre-execution, it - // will be all zero's so don't read it until we're - // trying to do an unwind & the reloc has been + // The address of the personality function will be stored at this + // location. Pre-execution, it will be all zero's so don't read it + // until we're trying to do an unwind & the reloc has been // resolved. { uint8_t arg_ptr_encoding = m_cfi_data.GetU8(&offset); @@ -360,22 +356,21 @@ DWARFCallFrameInfo::ParseCIE(const dw_offset_t cie_offset) { case 'R': // A 'R' may be present at any position after the - // first character of the string. The Augmentation - // Data shall include a 1 byte argument that - // represents the pointer encoding for the address - // pointers used in the FDE. - // Example: 0x1B == DW_EH_PE_pcrel | DW_EH_PE_sdata4 + // first character of the string. The Augmentation Data shall + // include a 1 byte argument that represents the pointer encoding + // for the address pointers used in the FDE. Example: 0x1B == + // DW_EH_PE_pcrel | DW_EH_PE_sdata4 cie_sp->ptr_encoding = m_cfi_data.GetU8(&offset); break; } } } else if (strcmp(cie_sp->augmentation, "eh") == 0) { - // If the Augmentation string has the value "eh", then - // the EH Data field shall be present + // If the Augmentation string has the value "eh", then the EH Data + // field shall be present } - // Set the offset to be the end of the augmentation data just in case - // we didn't understand any of the data. + // Set the offset to be the end of the augmentation data just in case we + // didn't understand any of the data. offset = (uint32_t)aug_data_end; } @@ -408,10 +403,8 @@ void DWARFCallFrameInfo::GetCFIData() { } } // Scan through the eh_frame or debug_frame section looking for FDEs and noting -// the start/end addresses -// of the functions and a pointer back to the function's FDE for later -// expansion. -// Internalize CIEs as we come across them. +// the start/end addresses of the functions and a pointer back to the +// function's FDE for later expansion. Internalize CIEs as we come across them. void DWARFCallFrameInfo::GetFDEIndex() { if (m_section_sp.get() == nullptr || m_section_sp->IsEncrypted()) @@ -469,8 +462,8 @@ void DWARFCallFrameInfo::GetFDEIndex() { } // An FDE entry contains CIE_pointer in debug_frame in same place as cie_id - // in eh_frame. CIE_pointer is an offset into the .debug_frame section. - // So, variable cie_offset should be equal to cie_id for debug_frame. + // in eh_frame. CIE_pointer is an offset into the .debug_frame section. So, + // variable cie_offset should be equal to cie_id for debug_frame. // FDE entries with cie_id == 0 shouldn't be ignored for it. if ((cie_id == 0 && m_type == EH) || cie_id == UINT32_MAX || len == 0) { auto cie_sp = ParseCIE(current_entry); @@ -556,9 +549,8 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset, // FDE entries with zeroth cie_offset may occur for debug_frame. assert(!(m_type == EH && 0 == cie_offset) && cie_offset != UINT32_MAX); - // Translate the CIE_id from the eh_frame format, which - // is relative to the FDE offset, into a __eh_frame section - // offset + // Translate the CIE_id from the eh_frame format, which is relative to the + // FDE offset, into a __eh_frame section offset if (m_type == EH) { unwind_plan.SetSourceName("eh_frame CFI"); cie_offset = current_entry + (is_64bit ? 12 : 4) - cie_offset; @@ -652,10 +644,10 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset, case DW_CFA_advance_loc: // (Row Creation Instruction) { // 0x40 - high 2 bits are 0x1, lower 6 bits are delta // takes a single argument that represents a constant delta. The - // required action is to create a new table row with a location - // value that is computed by taking the current entry's location - // value and adding (delta * code_align). All other - // values in the new row are initially identical to the current row. + // required action is to create a new table row with a location value + // that is computed by taking the current entry's location value and + // adding (delta * code_align). All other values in the new row are + // initially identical to the current row. unwind_plan.AppendRow(row); UnwindPlan::Row *newrow = new UnwindPlan::Row; *newrow = *row.get(); @@ -670,11 +662,10 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset, // required action is to change the rule for the indicated register // to the rule assigned it by the initial_instructions in the CIE. uint32_t reg_num = extended_opcode; - // We only keep enough register locations around to - // unwind what is in our thread, and these are organized - // by the register index in that state, so we need to convert our - // eh_frame register number from the EH frame info, to a register - // index + // We only keep enough register locations around to unwind what is in + // our thread, and these are organized by the register index in that + // state, so we need to convert our eh_frame register number from the + // EH frame info, to a register index if (unwind_plan.IsValidRowIndex(0) && unwind_plan.GetRowAtIndex(0)->GetRegisterInfo(reg_num, @@ -756,8 +747,8 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset, case DW_CFA_remember_state: // 0xA { // These instructions define a stack of information. Encountering the - // DW_CFA_remember_state instruction means to save the rules for every - // register on the current row on the stack. Encountering the + // DW_CFA_remember_state instruction means to save the rules for + // every register on the current row on the stack. Encountering the // DW_CFA_restore_state instruction means to pop the set of rules off // the stack and place them in the current row. (This operation is // useful for compilers that move epilogue code into the body of a @@ -772,8 +763,8 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset, case DW_CFA_restore_state: // 0xB { // These instructions define a stack of information. Encountering the - // DW_CFA_remember_state instruction means to save the rules for every - // register on the current row on the stack. Encountering the + // DW_CFA_remember_state instruction means to save the rules for + // every register on the current row on the stack. Encountering the // DW_CFA_restore_state instruction means to pop the set of rules off // the stack and place them in the current row. (This operation is // useful for compilers that move epilogue code into the body of a @@ -798,10 +789,9 @@ bool DWARFCallFrameInfo::FDEToUnwindPlan(dw_offset_t dwarf_offset, case DW_CFA_GNU_args_size: // 0x2e { // The DW_CFA_GNU_args_size instruction takes an unsigned LEB128 - // operand - // representing an argument size. This instruction specifies the total - // of - // the size of the arguments which have been pushed onto the stack. + // operand representing an argument size. This instruction specifies + // the total of the size of the arguments which have been pushed onto + // the stack. // TODO: Figure out how we should handle this. m_cfi_data.GetULEB128(&offset); @@ -834,9 +824,9 @@ bool DWARFCallFrameInfo::HandleCommonDwarfOpcode(uint8_t primary_opcode, // register // takes two arguments: an unsigned LEB128 constant representing a // factored offset and a register number. The required action is to - // change the rule for the register indicated by the register number - // to be an offset(N) rule with a value of - // (N = factored offset * data_align). + // change the rule for the register indicated by the register number to + // be an offset(N) rule with a value of (N = factored offset * + // data_align). uint8_t reg_num = extended_opcode; int32_t op_offset = (int32_t)m_cfi_data.GetULEB128(&offset) * data_align; reg_location.SetAtCFAPlusOffset(op_offset); @@ -851,8 +841,8 @@ bool DWARFCallFrameInfo::HandleCommonDwarfOpcode(uint8_t primary_opcode, case DW_CFA_offset_extended: // 0x5 { - // takes two unsigned LEB128 arguments representing a register number - // and a factored offset. This instruction is identical to DW_CFA_offset + // takes two unsigned LEB128 arguments representing a register number and + // a factored offset. This instruction is identical to DW_CFA_offset // except for the encoding and size of the register argument. uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); int32_t op_offset = (int32_t)m_cfi_data.GetULEB128(&offset) * data_align; @@ -888,9 +878,9 @@ bool DWARFCallFrameInfo::HandleCommonDwarfOpcode(uint8_t primary_opcode, case DW_CFA_register: // 0x9 { - // takes two unsigned LEB128 arguments representing register numbers. - // The required action is to set the rule for the first register to be - // the second register. + // takes two unsigned LEB128 arguments representing register numbers. The + // required action is to set the rule for the first register to be the + // second register. uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); uint32_t other_reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); UnwindPlan::Row::RegisterLocation reg_location; @@ -901,10 +891,9 @@ bool DWARFCallFrameInfo::HandleCommonDwarfOpcode(uint8_t primary_opcode, case DW_CFA_def_cfa: // 0xC (CFA Definition Instruction) { - // Takes two unsigned LEB128 operands representing a register - // number and a (non-factored) offset. The required action - // is to define the current CFA rule to use the provided - // register and offset. + // Takes two unsigned LEB128 operands representing a register number and + // a (non-factored) offset. The required action is to define the current + // CFA rule to use the provided register and offset. uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); int32_t op_offset = (int32_t)m_cfi_data.GetULEB128(&offset); row.GetCFAValue().SetIsRegisterPlusOffset(reg_num, op_offset); @@ -914,8 +903,8 @@ bool DWARFCallFrameInfo::HandleCommonDwarfOpcode(uint8_t primary_opcode, case DW_CFA_def_cfa_register: // 0xD (CFA Definition Instruction) { // takes a single unsigned LEB128 argument representing a register - // number. The required action is to define the current CFA rule to - // use the provided register (but to keep the old offset). + // number. The required action is to define the current CFA rule to use + // the provided register (but to keep the old offset). uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); row.GetCFAValue().SetIsRegisterPlusOffset(reg_num, row.GetCFAValue().GetOffset()); @@ -924,10 +913,9 @@ bool DWARFCallFrameInfo::HandleCommonDwarfOpcode(uint8_t primary_opcode, case DW_CFA_def_cfa_offset: // 0xE (CFA Definition Instruction) { - // Takes a single unsigned LEB128 operand representing a - // (non-factored) offset. The required action is to define - // the current CFA rule to use the provided offset (but - // to keep the old register). + // Takes a single unsigned LEB128 operand representing a (non-factored) + // offset. The required action is to define the current CFA rule to use + // the provided offset (but to keep the old register). int32_t op_offset = (int32_t)m_cfi_data.GetULEB128(&offset); row.GetCFAValue().SetIsRegisterPlusOffset( row.GetCFAValue().GetRegisterNumber(), op_offset); @@ -945,14 +933,13 @@ bool DWARFCallFrameInfo::HandleCommonDwarfOpcode(uint8_t primary_opcode, case DW_CFA_expression: // 0x10 { - // Takes two operands: an unsigned LEB128 value representing - // a register number, and a DW_FORM_block value representing a DWARF - // expression. The required action is to change the rule for the - // register indicated by the register number to be an expression(E) - // rule where E is the DWARF expression. That is, the DWARF - // expression computes the address. The value of the CFA is - // pushed on the DWARF evaluation stack prior to execution of - // the DWARF expression. + // Takes two operands: an unsigned LEB128 value representing a register + // number, and a DW_FORM_block value representing a DWARF expression. The + // required action is to change the rule for the register indicated by + // the register number to be an expression(E) rule where E is the DWARF + // expression. That is, the DWARF expression computes the address. The + // value of the CFA is pushed on the DWARF evaluation stack prior to + // execution of the DWARF expression. uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); uint32_t block_len = (uint32_t)m_cfi_data.GetULEB128(&offset); const uint8_t *block_data = @@ -965,10 +952,10 @@ bool DWARFCallFrameInfo::HandleCommonDwarfOpcode(uint8_t primary_opcode, case DW_CFA_offset_extended_sf: // 0x11 { - // takes two operands: an unsigned LEB128 value representing a - // register number and a signed LEB128 factored offset. This - // instruction is identical to DW_CFA_offset_extended except - // that the second operand is signed and factored. + // takes two operands: an unsigned LEB128 value representing a register + // number and a signed LEB128 factored offset. This instruction is + // identical to DW_CFA_offset_extended except that the second operand is + // signed and factored. uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); int32_t op_offset = (int32_t)m_cfi_data.GetSLEB128(&offset) * data_align; UnwindPlan::Row::RegisterLocation reg_location; @@ -979,10 +966,10 @@ bool DWARFCallFrameInfo::HandleCommonDwarfOpcode(uint8_t primary_opcode, case DW_CFA_def_cfa_sf: // 0x12 (CFA Definition Instruction) { - // Takes two operands: an unsigned LEB128 value representing - // a register number and a signed LEB128 factored offset. - // This instruction is identical to DW_CFA_def_cfa except - // that the second operand is signed and factored. + // Takes two operands: an unsigned LEB128 value representing a register + // number and a signed LEB128 factored offset. This instruction is + // identical to DW_CFA_def_cfa except that the second operand is signed + // and factored. uint32_t reg_num = (uint32_t)m_cfi_data.GetULEB128(&offset); int32_t op_offset = (int32_t)m_cfi_data.GetSLEB128(&offset) * data_align; row.GetCFAValue().SetIsRegisterPlusOffset(reg_num, op_offset); @@ -991,9 +978,9 @@ bool DWARFCallFrameInfo::HandleCommonDwarfOpcode(uint8_t primary_opcode, case DW_CFA_def_cfa_offset_sf: // 0x13 (CFA Definition Instruction) { - // takes a signed LEB128 operand representing a factored - // offset. This instruction is identical to DW_CFA_def_cfa_offset - // except that the operand is signed and factored. + // takes a signed LEB128 operand representing a factored offset. This + // instruction is identical to DW_CFA_def_cfa_offset except that the + // operand is signed and factored. int32_t op_offset = (int32_t)m_cfi_data.GetSLEB128(&offset) * data_align; uint32_t cfa_regnum = row.GetCFAValue().GetRegisterNumber(); row.GetCFAValue().SetIsRegisterPlusOffset(cfa_regnum, op_offset); @@ -1003,9 +990,9 @@ bool DWARFCallFrameInfo::HandleCommonDwarfOpcode(uint8_t primary_opcode, case DW_CFA_val_expression: // 0x16 { // takes two operands: an unsigned LEB128 value representing a register - // number, and a DW_FORM_block value representing a DWARF expression. - // The required action is to change the rule for the register indicated - // by the register number to be a val_expression(E) rule where E is the + // number, and a DW_FORM_block value representing a DWARF expression. The + // required action is to change the rule for the register indicated by + // the register number to be a val_expression(E) rule where E is the // DWARF expression. That is, the DWARF expression computes the value of // the given register. The value of the CFA is pushed on the DWARF // evaluation stack prior to execution of the DWARF expression. diff --git a/lldb/source/Symbol/FuncUnwinders.cpp b/lldb/source/Symbol/FuncUnwinders.cpp index b9f50cd1b12..2384d35e3d3 100644 --- a/lldb/source/Symbol/FuncUnwinders.cpp +++ b/lldb/source/Symbol/FuncUnwinders.cpp @@ -174,10 +174,9 @@ UnwindPlanSP FuncUnwinders::GetEHFrameAugmentedUnwindPlan(Target &target, m_tried_unwind_plan_eh_frame_augmented) return m_unwind_plan_eh_frame_augmented_sp; - // Only supported on x86 architectures where we get eh_frame from the compiler - // that describes - // the prologue instructions perfectly, and sometimes the epilogue - // instructions too. + // Only supported on x86 architectures where we get eh_frame from the + // compiler that describes the prologue instructions perfectly, and sometimes + // the epilogue instructions too. if (target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_32_i386 && target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_64_x86_64 && target.GetArchitecture().GetCore() != ArchSpec::eCore_x86_64_x86_64h) { @@ -194,8 +193,7 @@ UnwindPlanSP FuncUnwinders::GetEHFrameAugmentedUnwindPlan(Target &target, m_unwind_plan_eh_frame_augmented_sp.reset(new UnwindPlan(*eh_frame_plan)); // Augment the eh_frame instructions with epilogue descriptions if necessary - // so the - // UnwindPlan can be used at any instruction in the function. + // so the UnwindPlan can be used at any instruction in the function. UnwindAssemblySP assembly_profiler_sp(GetUnwindAssemblyProfiler(target)); if (assembly_profiler_sp) { @@ -238,7 +236,8 @@ FuncUnwinders::GetDebugFrameAugmentedUnwindPlan(Target &target, Thread &thread, new UnwindPlan(*debug_frame_plan)); // Augment the debug_frame instructions with epilogue descriptions if - // necessary so the UnwindPlan can be used at any instruction in the function. + // necessary so the UnwindPlan can be used at any instruction in the + // function. UnwindAssemblySP assembly_profiler_sp(GetUnwindAssemblyProfiler(target)); if (assembly_profiler_sp) { @@ -275,8 +274,7 @@ UnwindPlanSP FuncUnwinders::GetAssemblyUnwindPlan(Target &target, // This method compares the pc unwind rule in the first row of two UnwindPlans. // If they have the same way of getting the pc value (e.g. "CFA - 8" + "CFA is -// sp"), -// then it will return LazyBoolTrue. +// sp"), then it will return LazyBoolTrue. LazyBool FuncUnwinders::CompareUnwindPlansForIdenticalInitialPCLocation( Thread &thread, const UnwindPlanSP &a, const UnwindPlanSP &b) { LazyBool plans_are_identical = eLazyBoolCalculate; @@ -320,22 +318,22 @@ UnwindPlanSP FuncUnwinders::GetUnwindPlanAtNonCallSite(Target &target, UnwindPlanSP assembly_sp = GetAssemblyUnwindPlan(target, thread, current_offset); - // This point of this code is to detect when a function is using a - // non-standard ABI, and the eh_frame correctly describes that alternate ABI. + // This point of this code is to detect when a function is using a non- + // standard ABI, and the eh_frame correctly describes that alternate ABI. // This is addressing a specific situation on x86_64 linux systems where one // function in a library pushes a value on the stack and jumps to another - // function. So using an assembly instruction based unwind will not work when - // you're in the second function - the stack has been modified in a non-ABI - // way. But we have eh_frame that correctly describes how to unwind from this - // location. So we're looking to see if the initial pc register save location - // from the eh_frame is different from the assembly unwind, the arch default - // unwind, and the arch default at initial function entry. + // function. So using an assembly instruction based unwind will not work + // when you're in the second function - the stack has been modified in a non- + // ABI way. But we have eh_frame that correctly describes how to unwind from + // this location. So we're looking to see if the initial pc register save + // location from the eh_frame is different from the assembly unwind, the arch + // default unwind, and the arch default at initial function entry. // // We may have eh_frame that describes the entire function -- or we may have // eh_frame that only describes the unwind after the prologue has executed -- // so we need to check both the arch default (once the prologue has executed) - // and the arch default at initial function entry. And we may be running on a - // target where we have only some of the assembly/arch default unwind plans + // and the arch default at initial function entry. And we may be running on + // a target where we have only some of the assembly/arch default unwind plans // available. if (CompareUnwindPlansForIdenticalInitialPCLocation( diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp index 9464cef0bc7..f642c186a19 100644 --- a/lldb/source/Symbol/Function.cpp +++ b/lldb/source/Symbol/Function.cpp @@ -24,9 +24,8 @@ using namespace lldb; using namespace lldb_private; //---------------------------------------------------------------------- -// Basic function information is contained in the FunctionInfo class. -// It is designed to contain the name, linkage name, and declaration -// location. +// Basic function information is contained in the FunctionInfo class. It is +// designed to contain the name, linkage name, and declaration location. //---------------------------------------------------------------------- FunctionInfo::FunctionInfo(const char *name, const Declaration *decl_ptr) : m_name(name), m_declaration(decl_ptr) {} @@ -188,8 +187,7 @@ void Function::GetEndLineSourceInfo(FileSpec &source_file, uint32_t &line_no) { source_file.Clear(); // The -1 is kind of cheesy, but I want to get the last line entry for the - // given function, not the - // first entry of the next. + // given function, not the first entry of the next. Address scratch_addr(GetAddressRange().GetBaseAddress()); scratch_addr.SetOffset(scratch_addr.GetOffset() + GetAddressRange().GetByteSize() - 1); @@ -331,9 +329,8 @@ size_t Function::MemorySize() const { bool Function::GetIsOptimized() { bool result = false; - // Currently optimization is only indicted by the - // vendor extension DW_AT_APPLE_optimized which - // is set on a compile unit level. + // Currently optimization is only indicted by the vendor extension + // DW_AT_APPLE_optimized which is set on a compile unit level. if (m_comp_unit) { result = m_comp_unit->GetIsOptimized(); } @@ -441,11 +438,11 @@ uint32_t Function::GetPrologueByteSize() { } } - // If we didn't find the end of the prologue in the line tables, - // then just use the end address of the first line table entry + // If we didn't find the end of the prologue in the line tables, then + // just use the end address of the first line table entry if (prologue_end_file_addr == LLDB_INVALID_ADDRESS) { - // Check the first few instructions and look for one that has - // a line number that's different than the first entry. + // Check the first few instructions and look for one that has a line + // number that's different than the first entry. uint32_t last_line_entry_idx = first_line_entry_idx + 6; for (uint32_t idx = first_line_entry_idx + 1; idx < last_line_entry_idx; ++idx) { @@ -498,8 +495,8 @@ uint32_t Function::GetPrologueByteSize() { } } - // Verify that this prologue end file address in the function's - // address range just to be sure + // Verify that this prologue end file address in the function's address + // range just to be sure if (func_start_file_addr < prologue_end_file_addr && prologue_end_file_addr < func_end_file_addr) { m_prologue_byte_size = prologue_end_file_addr - func_start_file_addr; diff --git a/lldb/source/Symbol/GoASTContext.cpp b/lldb/source/Symbol/GoASTContext.cpp index 6761a605e46..da5c82b2cb5 100644 --- a/lldb/source/Symbol/GoASTContext.cpp +++ b/lldb/source/Symbol/GoASTContext.cpp @@ -667,8 +667,7 @@ GoASTContext::GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) { } // Returns -1 if this isn't a function of if the function doesn't have a -// prototype -// Returns a value >= 0 if there is a prototype. +// prototype Returns a value >= 0 if there is a prototype. int GoASTContext::GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) { return GetNumberOfFunctionArguments(type); } @@ -1008,8 +1007,8 @@ CompilerType GoASTContext::GetChildCompilerTypeAtIndex( return CompilerType(); } -// Lookup a child given a name. This function will match base class names -// and member member names in "clang_type" only, not descendants. +// Lookup a child given a name. This function will match base class names and +// member member names in "clang_type" only, not descendants. uint32_t GoASTContext::GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, @@ -1048,8 +1047,8 @@ size_t GoASTContext::GetIndexOfChildMemberWithName( return 1; } -// Converts "s" to a floating point value and place resulting floating -// point bytes in the "dst" buffer. +// Converts "s" to a floating point value and place resulting floating point +// bytes in the "dst" buffer. size_t GoASTContext::ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, const char *s, uint8_t *dst, @@ -1080,9 +1079,8 @@ void GoASTContext::DumpValue(lldb::opaque_compiler_type_t type, uint32_t field_idx = 0; for (auto *field = st->GetField(field_idx); field != nullptr; field_idx++) { - // Print the starting squiggly bracket (if this is the - // first member) or comma (for member 2 and beyond) for - // the struct/union/class member. + // Print the starting squiggly bracket (if this is the first member) or + // comma (for member 2 and beyond) for the struct/union/class member. if (field_idx == 0) s->PutChar('{'); else @@ -1137,9 +1135,8 @@ void GoASTContext::DumpValue(lldb::opaque_compiler_type_t type, uint64_t element_idx; for (element_idx = 0; element_idx < a->GetLength(); ++element_idx) { - // Print the starting squiggly bracket (if this is the - // first member) or comman (for member 2 and beyong) for - // the struct/union/class member. + // Print the starting squiggly bracket (if this is the first member) or + // comman (for member 2 and beyong) for the struct/union/class member. if (element_idx == 0) s->PutChar('{'); else diff --git a/lldb/source/Symbol/LineEntry.cpp b/lldb/source/Symbol/LineEntry.cpp index 691afdf5ed0..21aa2557518 100644 --- a/lldb/source/Symbol/LineEntry.cpp +++ b/lldb/source/Symbol/LineEntry.cpp @@ -170,9 +170,9 @@ int LineEntry::Compare(const LineEntry &a, const LineEntry &b) { if (a_byte_size > b_byte_size) return +1; - // Check for an end sequence entry mismatch after we have determined - // that the address values are equal. If one of the items is an end - // sequence, we don't care about the line, file, or column info. + // Check for an end sequence entry mismatch after we have determined that the + // address values are equal. If one of the items is an end sequence, we don't + // care about the line, file, or column info. if (a.is_terminal_entry > b.is_terminal_entry) return -1; if (a.is_terminal_entry < b.is_terminal_entry) @@ -192,8 +192,8 @@ int LineEntry::Compare(const LineEntry &a, const LineEntry &b) { } AddressRange LineEntry::GetSameLineContiguousAddressRange() const { - // Add each LineEntry's range to complete_line_range until we find - // a different file / line number. + // Add each LineEntry's range to complete_line_range until we find a + // different file / line number. AddressRange complete_line_range = range; while (true) { @@ -206,9 +206,8 @@ AddressRange LineEntry::GetSameLineContiguousAddressRange() const { if (next_line_sc.line_entry.IsValid() && next_line_sc.line_entry.range.GetByteSize() > 0 && original_file == next_line_sc.line_entry.original_file) { - // Include any line 0 entries - they indicate that this is - // compiler-generated code - // that does not correspond to user source code. + // Include any line 0 entries - they indicate that this is compiler- + // generated code that does not correspond to user source code. if (next_line_sc.line_entry.line == 0) { complete_line_range.SetByteSize( complete_line_range.GetByteSize() + @@ -217,10 +216,9 @@ AddressRange LineEntry::GetSameLineContiguousAddressRange() const { } if (line == next_line_sc.line_entry.line) { - // next_line_sc is the same file & line as this LineEntry, so extend our - // AddressRange by its size and continue to see if there are more - // LineEntries - // that we can combine. + // next_line_sc is the same file & line as this LineEntry, so extend + // our AddressRange by its size and continue to see if there are more + // LineEntries that we can combine. complete_line_range.SetByteSize( complete_line_range.GetByteSize() + next_line_sc.line_entry.range.GetByteSize()); diff --git a/lldb/source/Symbol/LineTable.cpp b/lldb/source/Symbol/LineTable.cpp index 3cb30530292..06e30219f09 100644 --- a/lldb/source/Symbol/LineTable.cpp +++ b/lldb/source/Symbol/LineTable.cpp @@ -73,30 +73,24 @@ void LineTable::AppendLineEntryToSequence( is_terminal_entry); entry_collection &entries = seq->m_entries; // Replace the last entry if the address is the same, otherwise append it. If - // we have multiple - // line entries at the same address, this indicates illegal DWARF so this - // "fixes" the line table - // to be correct. If not fixed this can cause a line entry's address that when - // resolved back to - // a symbol context, could resolve to a different line entry. We really want a + // we have multiple line entries at the same address, this indicates illegal + // DWARF so this "fixes" the line table to be correct. If not fixed this can + // cause a line entry's address that when resolved back to a symbol context, + // could resolve to a different line entry. We really want a // 1 to 1 mapping - // here to avoid these kinds of inconsistencies. We will need tor revisit this - // if the DWARF line - // tables are updated to allow multiple entries at the same address legally. + // here to avoid these kinds of inconsistencies. We will need tor revisit + // this if the DWARF line tables are updated to allow multiple entries at the + // same address legally. if (!entries.empty() && entries.back().file_addr == file_addr) { // GCC don't use the is_prologue_end flag to mark the first instruction // after the prologue. // Instead of it it is issuing a line table entry for the first instruction - // of the prologue - // and one for the first instruction after the prologue. If the size of the - // prologue is 0 - // instruction then the 2 line entry will have the same file address. - // Removing it will remove - // our ability to properly detect the location of the end of prologe so we - // set the prologue_end - // flag to preserve this information (setting the prologue_end flag for an - // entry what is after - // the prologue end don't have any effect) + // of the prologue and one for the first instruction after the prologue. If + // the size of the prologue is 0 instruction then the 2 line entry will + // have the same file address. Removing it will remove our ability to + // properly detect the location of the end of prologe so we set the + // prologue_end flag to preserve this information (setting the prologue_end + // flag for an entry what is after the prologue end don't have any effect) entry.is_prologue_end = entry.file_idx == entries.back().file_idx; entries.back() = entry; } else @@ -200,14 +194,13 @@ bool LineTable::FindLineEntryByAddress(const Address &so_addr, if (pos->file_addr != search_entry.file_addr) --pos; else if (pos->file_addr == search_entry.file_addr) { - // If this is a termination entry, it shouldn't match since - // entries with the "is_terminal_entry" member set to true - // are termination entries that define the range for the - // previous entry. + // If this is a termination entry, it shouldn't match since entries + // with the "is_terminal_entry" member set to true are termination + // entries that define the range for the previous entry. if (pos->is_terminal_entry) { - // The matching entry is a terminal entry, so we skip - // ahead to the next entry to see if there is another - // entry following this one whose section/offset matches. + // The matching entry is a terminal entry, so we skip ahead to + // the next entry to see if there is another entry following this + // one whose section/offset matches. ++pos; if (pos != end_pos) { if (pos->file_addr != search_entry.file_addr) @@ -216,9 +209,8 @@ bool LineTable::FindLineEntryByAddress(const Address &so_addr, } if (pos != end_pos) { - // While in the same section/offset backup to find the first - // line entry that matches the address in case there are - // multiple + // While in the same section/offset backup to find the first line + // entry that matches the address in case there are multiple while (pos != begin_pos) { entry_collection::const_iterator prev_pos = pos - 1; if (prev_pos->file_addr == search_entry.file_addr && @@ -232,16 +224,15 @@ bool LineTable::FindLineEntryByAddress(const Address &so_addr, } else { - // There might be code in the containing objfile before the first line - // table entry. Make sure that does not get considered part of the first - // line table entry. + // There might be code in the containing objfile before the first + // line table entry. Make sure that does not get considered part of + // the first line table entry. if (pos->file_addr > so_addr.GetFileAddress()) return false; } // Make sure we have a valid match and that the match isn't a - // terminating - // entry for a previous line... + // terminating entry for a previous line... if (pos != end_pos && pos->is_terminal_entry == false) { uint32_t match_idx = std::distance(begin_pos, pos); success = ConvertEntryAtIndexToLineEntry(match_idx, line_entry); @@ -304,8 +295,7 @@ uint32_t LineTable::FindLineEntryIndexByFileIndex( continue; // Exact match always wins. Otherwise try to find the closest line > the - // desired - // line. + // desired line. // FIXME: Maybe want to find the line closest before and the line closest // after and // if they're not in the same function, don't return a match. @@ -349,8 +339,7 @@ uint32_t LineTable::FindLineEntryIndexByFileIndex(uint32_t start_idx, continue; // Exact match always wins. Otherwise try to find the closest line > the - // desired - // line. + // desired line. // FIXME: Maybe want to find the line closest before and the line closest // after and // if they're not in the same function, don't return a match. @@ -389,8 +378,8 @@ size_t LineTable::FineLineEntriesForFileIndex(uint32_t file_idx, bool append, SymbolContext sc(m_comp_unit); for (size_t idx = 0; idx < count; ++idx) { - // Skip line table rows that terminate the previous row (is_terminal_entry - // is non-zero) + // Skip line table rows that terminate the previous row + // (is_terminal_entry is non-zero) if (m_entries[idx].is_terminal_entry) continue; @@ -497,10 +486,9 @@ LineTable *LineTable::LinkLineTable(const FileRangeMap &file_range_map) { terminate_previous_entry = prev_entry_was_linked; } } else if (prev_entry_was_linked) { - // This entry doesn't have a remapping and it needs to be removed. - // Watch out in case we need to terminate a previous entry needs to - // be terminated now that one line entry in a sequence is not longer - // valid. + // This entry doesn't have a remapping and it needs to be removed. Watch + // out in case we need to terminate a previous entry needs to be + // terminated now that one line entry in a sequence is not longer valid. if (!sequence.m_entries.empty() && !sequence.m_entries.back().is_terminal_entry) { terminate_previous_entry = true; diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index 9210b75d3d0..878f1fb7178 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -50,10 +50,9 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file, const bool file_exists = file->Exists(); if (!data_sp) { - // We have an object name which most likely means we have - // a .o file in a static archive (.a file). Try and see if - // we have a cached archive first without reading any data - // first + // We have an object name which most likely means we have a .o file in + // a static archive (.a file). Try and see if we have a cached archive + // first without reading any data first if (file_exists && module_sp->GetObjectName()) { for (uint32_t idx = 0; (create_object_container_callback = @@ -72,10 +71,10 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file, return object_file_sp; } } - // Ok, we didn't find any containers that have a named object, now - // lets read the first 512 bytes from the file so the object file - // and object container plug-ins can use these bytes to see if they - // can parse this file. + // Ok, we didn't find any containers that have a named object, now lets + // read the first 512 bytes from the file so the object file and object + // container plug-ins can use these bytes to see if they can parse this + // file. if (file_size > 0) { data_sp = DataBufferLLVM::CreateSliceFromPath(file->GetPath(), 512, file_offset); @@ -98,11 +97,12 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file, file = &archive_file; module_sp->SetFileSpecAndObjectName(archive_file, archive_object); // Check if this is a object container by iterating through all - // object - // container plugin instances and then trying to get an object file - // from the container plugins since we had a name. Also, don't read + // object container plugin instances and then trying to get an + // object file from the container plugins since we had a name. + // Also, don't read // ANY data in case there is data cached in the container plug-ins - // (like BSD archives caching the contained objects within an file). + // (like BSD archives caching the contained objects within an + // file). for (uint32_t idx = 0; (create_object_container_callback = PluginManager::GetObjectContainerCreateCallbackAtIndex( @@ -119,8 +119,8 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file, if (object_file_sp.get()) return object_file_sp; } - // We failed to find any cached object files in the container - // plug-ins, so lets read the first 512 bytes and try again below... + // We failed to find any cached object files in the container plug- + // ins, so lets read the first 512 bytes and try again below... data_sp = DataBufferLLVM::CreateSliceFromPath(archive_file.GetPath(), 512, file_offset); } @@ -128,8 +128,8 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file, } if (data_sp && data_sp->GetByteSize() > 0) { - // Check if this is a normal object file by iterating through - // all object file plugin instances. + // Check if this is a normal object file by iterating through all + // object file plugin instances. ObjectFileCreateInstance create_object_file_callback; for (uint32_t idx = 0; (create_object_file_callback = @@ -142,9 +142,9 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file, return object_file_sp; } - // Check if this is a object container by iterating through - // all object container plugin instances and then trying to get - // an object file from the container. + // Check if this is a object container by iterating through all object + // container plugin instances and then trying to get an object file + // from the container. for (uint32_t idx = 0; (create_object_container_callback = PluginManager::GetObjectContainerCreateCallbackAtIndex( @@ -163,8 +163,8 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file, } } } - // We didn't find it, so clear our shared pointer in case it - // contains anything and return an empty shared pointer + // We didn't find it, so clear our shared pointer in case it contains + // anything and return an empty shared pointer object_file_sp.reset(); return object_file_sp; } @@ -185,8 +185,8 @@ ObjectFileSP ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, static_cast<void *>(process_sp.get()), header_addr); uint32_t idx; - // Check if this is a normal object file by iterating through - // all object file plugin instances. + // Check if this is a normal object file by iterating through all object + // file plugin instances. ObjectFileCreateMemoryInstance create_callback; for (idx = 0; (create_callback = @@ -200,8 +200,8 @@ ObjectFileSP ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, } } - // We didn't find it, so clear our shared pointer in case it - // contains anything and return an empty shared pointer + // We didn't find it, so clear our shared pointer in case it contains + // anything and return an empty shared pointer object_file_sp.reset(); return object_file_sp; } @@ -378,10 +378,8 @@ AddressClass ObjectFile::GetAddressClass(addr_t file_addr) { return eAddressClassUnknown; case eSectionTypeAbsoluteAddress: // In case of absolute sections decide the address class based on - // the symbol - // type because the section type isn't specify if it is a code or a - // data - // section. + // the symbol type because the section type isn't specify if it is + // a code or a data section. break; } } @@ -470,16 +468,14 @@ DataBufferSP ObjectFile::ReadMemory(const ProcessSP &process_sp, size_t ObjectFile::GetData(lldb::offset_t offset, size_t length, DataExtractor &data) const { // The entire file has already been mmap'ed into m_data, so just copy from - // there - // as the back mmap buffer will be shared with shared pointers. + // there as the back mmap buffer will be shared with shared pointers. return data.SetData(m_data, offset, length); } size_t ObjectFile::CopyData(lldb::offset_t offset, size_t length, void *dst) const { // The entire file has already been mmap'ed into m_data, so just copy from - // there - // Note that the data remains in target byte order. + // there Note that the data remains in target byte order. return m_data.CopyData(offset, length, dst); } @@ -559,8 +555,8 @@ size_t ObjectFile::ReadSectionData(Section *section, return GetData(section->GetFileOffset(), section->GetFileSize(), section_data); } else { - // The object file now contains a full mmap'ed copy of the object file data, - // so just use this + // The object file now contains a full mmap'ed copy of the object file + // data, so just use this if (!section->IsRelocated()) RelocateSection(section); diff --git a/lldb/source/Symbol/Symbol.cpp b/lldb/source/Symbol/Symbol.cpp index ab297ef330f..69fd5424bd9 100644 --- a/lldb/source/Symbol/Symbol.cpp +++ b/lldb/source/Symbol/Symbol.cpp @@ -122,9 +122,9 @@ ConstString Symbol::GetDisplayName() const { 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 @@ ConstString Symbol::GetReExportedSymbolName() const { 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 @@ FileSpec Symbol::GetReExportedSymbolSharedLibrary() const { 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 @@ uint32_t Symbol::GetPrologueByteSize() { 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 @@ uint32_t Symbol::GetPrologueByteSize() { 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 @@ uint32_t Symbol::GetPrologueByteSize() { 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 @@ uint32_t Symbol::GetPrologueByteSize() { } // 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 @@ Symbol *Symbol::ResolveReExportedSymbolInModuleSpec( // 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 @@ Symbol *Symbol::ResolveReExportedSymbolInModuleSpec( 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 @@ Symbol *Symbol::ResolveReExportedSymbolInModuleSpec( } } // 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 = diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp index 4ac35010c74..8716f50a384 100644 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -359,8 +359,7 @@ void SymbolContext::Dump(Stream *s, Target *target) const { if (block != nullptr) *s << " {0x" << block->GetID() << '}'; // Dump the block and pass it a negative depth to we print all the parent - // blocks - // if (block != NULL) + // blocks if (block != NULL) // block->Dump(s, function->GetFileAddress(), INT_MIN); s->EOL(); s->Indent(); @@ -468,27 +467,27 @@ bool SymbolContext::GetParentOfInlinedScope(const Address &curr_frame_pc, if (block) { // const addr_t curr_frame_file_addr = curr_frame_pc.GetFileAddress(); - // In order to get the parent of an inlined function we first need to - // see if we are in an inlined block as "this->block" could be an - // inlined block, or a parent of "block" could be. So lets check if - // this block or one of this blocks parents is an inlined function. + // In order to get the parent of an inlined function we first need to see + // if we are in an inlined block as "this->block" could be an inlined + // block, or a parent of "block" could be. So lets check if this block or + // one of this blocks parents is an inlined function. Block *curr_inlined_block = block->GetContainingInlinedBlock(); if (curr_inlined_block) { - // "this->block" is contained in an inline function block, so to - // get the scope above the inlined block, we get the parent of the - // inlined block itself + // "this->block" is contained in an inline function block, so to get the + // scope above the inlined block, we get the parent of the inlined block + // itself Block *next_frame_block = curr_inlined_block->GetParent(); // Now calculate the symbol context of the containing block next_frame_block->CalculateSymbolContext(&next_frame_sc); // If we get here we weren't able to find the return line entry using the - // nesting of the blocks and - // the line table. So just use the call site info from our inlined block. + // nesting of the blocks and the line table. So just use the call site + // info from our inlined block. AddressRange range; if (curr_inlined_block->GetRangeContainingAddress(curr_frame_pc, range)) { - // To see there this new frame block it, we need to look at the - // call site information from + // To see there this new frame block it, we need to look at the call + // site information from const InlineFunctionInfo *curr_inlined_block_inlined_info = curr_inlined_block->GetInlinedFunctionInfo(); next_frame_pc = range.GetBaseAddress(); @@ -550,22 +549,22 @@ bool SymbolContext::GetParentOfInlinedScope(const Address &curr_frame_pc, Block *SymbolContext::GetFunctionBlock() { if (function) { if (block) { - // If this symbol context has a block, check to see if this block - // is itself, or is contained within a block with inlined function - // information. If so, then the inlined block is the block that - // defines the function. + // If this symbol context has a block, check to see if this block is + // itself, or is contained within a block with inlined function + // information. If so, then the inlined block is the block that defines + // the function. Block *inlined_block = block->GetContainingInlinedBlock(); if (inlined_block) return inlined_block; - // The block in this symbol context is not inside an inlined - // block, so the block that defines the function is the function's - // top level block, which is returned below. + // The block in this symbol context is not inside an inlined block, so + // the block that defines the function is the function's top level block, + // which is returned below. } - // There is no block information in this symbol context, so we must - // assume that the block that is desired is the top level block of - // the function itself. + // There is no block information in this symbol context, so we must assume + // that the block that is desired is the top level block of the function + // itself. return &function->GetBlock(true); } return nullptr; @@ -594,8 +593,8 @@ void SymbolContext::SortTypeList(TypeMap &type_map, TypeList &type_list) const { isInlinedblock = true; //---------------------------------------------------------------------- - // Find all types that match the current block if we have one and put - // them first in the list. Keep iterating up through all blocks. + // Find all types that match the current block if we have one and put them + // first in the list. Keep iterating up through all blocks. //---------------------------------------------------------------------- while (curr_block != nullptr && !isInlinedblock) { type_map.ForEach( @@ -606,8 +605,8 @@ void SymbolContext::SortTypeList(TypeMap &type_map, TypeList &type_list) const { return true; // Keep iterating }); - // Remove any entries that are now in "type_list" from "type_map" - // since we can't remove from type_map while iterating + // Remove any entries that are now in "type_list" from "type_map" since we + // can't remove from type_map while iterating type_list.ForEach([&type_map](const lldb::TypeSP &type_sp) -> bool { type_map.Remove(type_sp); return true; // Keep iterating @@ -615,8 +614,8 @@ void SymbolContext::SortTypeList(TypeMap &type_map, TypeList &type_list) const { curr_block = curr_block->GetParent(); } //---------------------------------------------------------------------- - // Find all types that match the current function, if we have onem, and - // put them next in the list. + // Find all types that match the current function, if we have onem, and put + // them next in the list. //---------------------------------------------------------------------- if (function != nullptr && !type_map.Empty()) { const size_t old_type_list_size = type_list.GetSize(); @@ -627,8 +626,8 @@ void SymbolContext::SortTypeList(TypeMap &type_map, TypeList &type_list) const { return true; // Keep iterating }); - // Remove any entries that are now in "type_list" from "type_map" - // since we can't remove from type_map while iterating + // Remove any entries that are now in "type_list" from "type_map" since we + // can't remove from type_map while iterating const size_t new_type_list_size = type_list.GetSize(); if (new_type_list_size > old_type_list_size) { for (size_t i = old_type_list_size; i < new_type_list_size; ++i) @@ -636,8 +635,8 @@ void SymbolContext::SortTypeList(TypeMap &type_map, TypeList &type_list) const { } } //---------------------------------------------------------------------- - // Find all types that match the current compile unit, if we have one, - // and put them next in the list. + // Find all types that match the current compile unit, if we have one, and + // put them next in the list. //---------------------------------------------------------------------- if (comp_unit != nullptr && !type_map.Empty()) { const size_t old_type_list_size = type_list.GetSize(); @@ -649,8 +648,8 @@ void SymbolContext::SortTypeList(TypeMap &type_map, TypeList &type_list) const { return true; // Keep iterating }); - // Remove any entries that are now in "type_list" from "type_map" - // since we can't remove from type_map while iterating + // Remove any entries that are now in "type_list" from "type_map" since we + // can't remove from type_map while iterating const size_t new_type_list_size = type_list.GetSize(); if (new_type_list_size > old_type_list_size) { for (size_t i = old_type_list_size; i < new_type_list_size; ++i) @@ -658,8 +657,8 @@ void SymbolContext::SortTypeList(TypeMap &type_map, TypeList &type_list) const { } } //---------------------------------------------------------------------- - // Find all types that match the current module, if we have one, and put - // them next in the list. + // Find all types that match the current module, if we have one, and put them + // next in the list. //---------------------------------------------------------------------- if (module_sp && !type_map.Empty()) { const size_t old_type_list_size = type_list.GetSize(); @@ -669,8 +668,8 @@ void SymbolContext::SortTypeList(TypeMap &type_map, TypeList &type_list) const { type_list.Insert(type_sp); return true; // Keep iterating }); - // Remove any entries that are now in "type_list" from "type_map" - // since we can't remove from type_map while iterating + // Remove any entries that are now in "type_list" from "type_map" since we + // can't remove from type_map while iterating const size_t new_type_list_size = type_list.GetSize(); if (new_type_list_size > old_type_list_size) { for (size_t i = old_type_list_size; i < new_type_list_size; ++i) @@ -831,9 +830,9 @@ SymbolContext::FindBestGlobalDataSymbol(const ConstString &name, Status &error) case eSymbolTypeObjCMetaClass: case eSymbolTypeObjCIVar: if (symbol->GetDemangledNameIsSynthesized()) { - // If the demangled name was synthesized, then don't use it - // for expressions. Only let the symbol match if the mangled - // named matches for these symbols. + // If the demangled name was synthesized, then don't use it for + // expressions. Only let the symbol match if the mangled named + // matches for these symbols. if (symbol->GetMangled().GetMangledName() != name) break; } @@ -861,8 +860,8 @@ SymbolContext::FindBestGlobalDataSymbol(const ConstString &name, Status &error) target.GetImages().FindFirstModule(reexport_module_spec); } } - // Don't allow us to try and resolve a re-exported symbol if it is - // the same as the current symbol + // Don't allow us to try and resolve a re-exported symbol if it + // is the same as the current symbol if (name == symbol->GetReExportedSymbolName() && module == reexport_module_sp.get()) return nullptr; @@ -1012,9 +1011,8 @@ bool SymbolContextSpecifier::AddSpecification(const char *spec_string, } break; case eFileSpecified: // CompUnits can't necessarily be resolved here, since an inlined function - // might show up in - // a number of CompUnits. Instead we just convert to a FileSpec and store - // it away. + // might show up in a number of CompUnits. Instead we just convert to a + // FileSpec and store it away. m_file_spec_ap.reset(new FileSpec(spec_string, false)); m_type |= eFileSpecified; break; diff --git a/lldb/source/Symbol/SymbolFile.cpp b/lldb/source/Symbol/SymbolFile.cpp index eb20b80f491..c532cadf6be 100644 --- a/lldb/source/Symbol/SymbolFile.cpp +++ b/lldb/source/Symbol/SymbolFile.cpp @@ -30,8 +30,7 @@ SymbolFile *SymbolFile::FindPlugin(ObjectFile *obj_file) { if (obj_file != nullptr) { // We need to test the abilities of this section list. So create what it - // would - // be with this new obj_file. + // would be with this new obj_file. lldb::ModuleSP module_sp(obj_file->GetModule()); if (module_sp) { // Default to the main module section list. @@ -60,16 +59,16 @@ SymbolFile *SymbolFile::FindPlugin(ObjectFile *obj_file) { if (sym_file_abilities > best_symfile_abilities) { best_symfile_abilities = sym_file_abilities; best_symfile_ap.reset(curr_symfile_ap.release()); - // If any symbol file parser has all of the abilities, then - // we should just stop looking. + // If any symbol file parser has all of the abilities, then we should + // just stop looking. if ((kAllAbilities & sym_file_abilities) == kAllAbilities) break; } } } if (best_symfile_ap.get()) { - // Let the winning symbol file parser initialize itself more - // completely now that it has been chosen + // Let the winning symbol file parser initialize itself more completely + // now that it has been chosen best_symfile_ap->InitializeObject(); } } diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp index f5a08739f24..fd731888bef 100644 --- a/lldb/source/Symbol/SymbolVendor.cpp +++ b/lldb/source/Symbol/SymbolVendor.cpp @@ -26,9 +26,9 @@ using namespace lldb_private; //---------------------------------------------------------------------- // FindPlugin // -// Platforms can register a callback to use when creating symbol -// vendors to allow for complex debug information file setups, and to -// also allow for finding separate debug information files. +// Platforms can register a callback to use when creating symbol vendors to +// allow for complex debug information file setups, and to also allow for +// finding separate debug information files. //---------------------------------------------------------------------- SymbolVendor *SymbolVendor::FindPlugin(const lldb::ModuleSP &module_sp, lldb_private::Stream *feedback_strm) { @@ -45,8 +45,8 @@ SymbolVendor *SymbolVendor::FindPlugin(const lldb::ModuleSP &module_sp, return instance_ap.release(); } } - // The default implementation just tries to create debug information using the - // file representation for the module. + // The default implementation just tries to create debug information using + // the file representation for the module. instance_ap.reset(new SymbolVendor(module_sp)); if (instance_ap.get()) { ObjectFile *objfile = module_sp->GetObjectFile(); @@ -88,11 +88,11 @@ bool SymbolVendor::SetCompileUnitAtIndex(size_t idx, const CompUnitSP &cu_sp) { std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); const size_t num_compile_units = GetNumCompileUnits(); if (idx < num_compile_units) { - // Fire off an assertion if this compile unit already exists for now. - // The partial parsing should take care of only setting the compile - // unit once, so if this assertion fails, we need to make sure that - // we don't have a race condition, or have a second parse of the same - // compile unit. + // Fire off an assertion if this compile unit already exists for now. The + // partial parsing should take care of only setting the compile unit + // once, so if this assertion fails, we need to make sure that we don't + // have a race condition, or have a second parse of the same compile + // unit. assert(m_compile_units[idx].get() == nullptr); m_compile_units[idx] = cu_sp; return true; @@ -111,10 +111,10 @@ size_t SymbolVendor::GetNumCompileUnits() { std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); if (m_compile_units.empty()) { if (m_sym_file_ap.get()) { - // Resize our array of compile unit shared pointers -- which will - // each remain NULL until someone asks for the actual compile unit - // information. When this happens, the symbol file will be asked - // to parse this compile unit information. + // Resize our array of compile unit shared pointers -- which will each + // remain NULL until someone asks for the actual compile unit + // information. When this happens, the symbol file will be asked to + // parse this compile unit information. m_compile_units.resize(m_sym_file_ap->GetNumCompileUnits()); } } diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index 4ac30649110..c502b18555f 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -100,9 +100,8 @@ void Symtab::Dump(Stream *s, Target *target, SortOrder sort_order) { } break; case eSortOrderByName: { - // Although we maintain a lookup by exact name map, the table - // isn't sorted by name. So we must make the ordered symbol list - // up ourselves. + // Although we maintain a lookup by exact name map, the table isn't + // sorted by name. So we must make the ordered symbol list up ourselves. s->PutCString(" (sorted by name):\n"); DumpSymbolHeader(s); typedef std::multimap<const char *, const Symbol *, @@ -228,8 +227,8 @@ void Symtab::InitNameIndexes() { m_name_to_index.Reserve(num_symbols); #else // TODO: benchmark this to see if we save any memory. Otherwise we - // will always keep the memory reserved in the vector unless we pull - // some STL swap magic and then recopy... + // will always keep the memory reserved in the vector unless we pull some + // STL swap magic and then recopy... uint32_t actual_count = 0; for (const_iterator pos = m_symbols.begin(), end = m_symbols.end(); pos != end; ++pos) { @@ -255,11 +254,10 @@ void Symtab::InitNameIndexes() { for (entry.value = 0; entry.value < num_symbols; ++entry.value) { const Symbol *symbol = &m_symbols[entry.value]; - // Don't let trampolines get into the lookup by name map - // If we ever need the trampoline symbols to be searchable by name - // we can remove this and then possibly add a new bool to any of the - // Symtab functions that lookup symbols by name to indicate if they - // want trampolines. + // Don't let trampolines get into the lookup by name map If we ever need + // the trampoline symbols to be searchable by name we can remove this and + // then possibly add a new bool to any of the Symtab functions that + // lookup symbols by name to indicate if they want trampolines. if (symbol->IsTrampoline()) continue; @@ -293,10 +291,9 @@ void Symtab::InitNameIndexes() { mangled.GetDemangledName(lldb::eLanguageTypeC_plus_plus)); entry.cstring = ConstString(cxx_method.GetBasename()); if (entry.cstring) { - // ConstString objects permanently store the string in the pool so - // calling - // GetCString() on the value gets us a const char * that will - // never go away + // ConstString objects permanently store the string in the pool + // so calling GetCString() on the value gets us a const char * + // that will never go away const char *const_context = ConstString(cxx_method.GetContext()).GetCString(); @@ -312,25 +309,25 @@ void Symtab::InitNameIndexes() { if (entry_ref[0] == '~' || !cxx_method.GetQualifiers().empty()) { // The first character of the demangled basename is '~' which - // means we have a class destructor. We can use this information - // to help us know what is a class and what isn't. + // means we have a class destructor. We can use this + // information to help us know what is a class and what + // isn't. if (class_contexts.find(const_context) == class_contexts.end()) class_contexts.insert(const_context); m_method_to_index.Append(entry); } else { if (class_contexts.find(const_context) != class_contexts.end()) { - // The current decl context is in our "class_contexts" which - // means - // this is a method on a class + // The current decl context is in our "class_contexts" + // which means this is a method on a class m_method_to_index.Append(entry); } else { - // We don't know if this is a function basename or a method, - // so put it into a temporary collection so once we are done - // we can look in class_contexts to see if each entry is a - // class - // or just a function and will put any remaining items into - // m_method_to_index or m_basename_to_index as needed + // We don't know if this is a function basename or a + // method, so put it into a temporary collection so once we + // are done we can look in class_contexts to see if each + // entry is a class or just a function and will put any + // remaining items into m_method_to_index or + // m_basename_to_index as needed mangled_name_to_index.Append(entry); symbol_contexts[entry.value] = const_context; } @@ -354,9 +351,8 @@ void Symtab::InitNameIndexes() { } } - // If the demangled name turns out to be an ObjC name, and - // is a category name, add the version without categories to the index - // too. + // If the demangled name turns out to be an ObjC name, and is a category + // name, add the version without categories to the index too. ObjCLanguage::MethodName objc_method(entry.cstring.GetStringRef(), true); if (objc_method.IsValid(true)) { entry.cstring = objc_method.GetSelector(); @@ -383,8 +379,7 @@ void Symtab::InitNameIndexes() { m_method_to_index.Append(entry); } else { // If we got here, we have something that had a context (was inside - // a namespace or class) - // yet we don't know if the entry + // a namespace or class) yet we don't know if the entry m_method_to_index.Append(entry); m_basename_to_index.Append(entry); } @@ -520,20 +515,15 @@ struct SymbolIndexComparator { std::vector<lldb::addr_t> &addr_cache; // Getting from the symbol to the Address to the File Address involves some - // work. - // Since there are potentially many symbols here, and we're using this for - // sorting so - // we're going to be computing the address many times, cache that in - // addr_cache. - // The array passed in has to be the same size as the symbols array passed - // into the - // member variable symbols, and should be initialized with - // LLDB_INVALID_ADDRESS. + // work. Since there are potentially many symbols here, and we're using this + // for sorting so we're going to be computing the address many times, cache + // that in addr_cache. The array passed in has to be the same size as the + // symbols array passed into the member variable symbols, and should be + // initialized with LLDB_INVALID_ADDRESS. // NOTE: You have to make addr_cache externally and pass it in because // std::stable_sort // makes copies of the comparator it is initially passed in, and you end up - // spending - // huge amounts of time copying this array... + // spending huge amounts of time copying this array... SymbolIndexComparator(const std::vector<Symbol> &s, std::vector<lldb::addr_t> &a) @@ -584,8 +574,7 @@ void Symtab::SortSymbolIndexesByValue(std::vector<uint32_t> &indexes, // NOTE: The use of std::stable_sort instead of std::sort here is strictly for // performance, // not correctness. The indexes vector tends to be "close" to sorted, which - // the - // stable sort handles better. + // the stable sort handles better. std::vector<lldb::addr_t> addr_cache(m_symbols.size(), LLDB_INVALID_ADDRESS); @@ -752,14 +741,14 @@ Symtab::FindAllSymbolsWithNameAndType(const ConstString &name, static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION); - // Initialize all of the lookup by name indexes before converting NAME - // to a uniqued string NAME_STR below. + // Initialize all of the lookup by name indexes before converting NAME to a + // uniqued string NAME_STR below. if (!m_name_indexes_computed) InitNameIndexes(); if (name) { - // The string table did have a string that matched, but we need - // to check the symbols and match the symbol_type if any was given. + // The string table did have a string that matched, but we need to check + // the symbols and match the symbol_type if any was given. AppendSymbolIndexesWithNameAndType(name, symbol_type, symbol_indexes); } return symbol_indexes.size(); @@ -772,14 +761,14 @@ size_t Symtab::FindAllSymbolsWithNameAndType( static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION); - // Initialize all of the lookup by name indexes before converting NAME - // to a uniqued string NAME_STR below. + // Initialize all of the lookup by name indexes before converting NAME to a + // uniqued string NAME_STR below. if (!m_name_indexes_computed) InitNameIndexes(); if (name) { - // The string table did have a string that matched, but we need - // to check the symbols and match the symbol_type if any was given. + // The string table did have a string that matched, but we need to check + // the symbols and match the symbol_type if any was given. AppendSymbolIndexesWithNameAndType(name, symbol_type, symbol_debug_type, symbol_visibility, symbol_indexes); } @@ -810,8 +799,8 @@ Symbol *Symtab::FindFirstSymbolWithNameAndType(const ConstString &name, if (name) { std::vector<uint32_t> matching_indexes; - // The string table did have a string that matched, but we need - // to check the symbols and match the symbol_type if any was given. + // The string table did have a string that matched, but we need to check + // the symbols and match the symbol_type if any was given. if (AppendSymbolIndexesWithNameAndType(name, symbol_type, symbol_debug_type, symbol_visibility, matching_indexes)) { @@ -835,8 +824,8 @@ typedef struct { addr_t match_offset; } SymbolSearchInfo; -// Add all the section file start address & size to the RangeVector, -// recusively adding any children sections. +// Add all the section file start address & size to the RangeVector, recusively +// adding any children sections. static void AddSectionsToRangeMap(SectionList *sectlist, RangeVector<addr_t, addr_t> §ion_ranges) { const int num_sections = sectlist->GetNumSections(0); @@ -885,9 +874,9 @@ void Symtab::InitAddressIndexes() { // Create a RangeVector with the start & size of all the sections for // this objfile. We'll need to check this for any FileRangeToIndexMap - // entries with an uninitialized size, which could potentially be a - // large number so reconstituting the weak pointer is busywork when it - // is invariant information. + // entries with an uninitialized size, which could potentially be a large + // number so reconstituting the weak pointer is busywork when it is + // invariant information. SectionList *sectlist = m_objfile->GetSectionList(); RangeVector<addr_t, addr_t> section_ranges; if (sectlist) { @@ -922,9 +911,8 @@ void Symtab::InitAddressIndexes() { if (next_base_addr > curr_base_addr) { addr_t size_to_next_symbol = next_base_addr - curr_base_addr; - // Take the difference between this symbol and the next one as its - // size, - // if it is less than the size of the section. + // Take the difference between this symbol and the next one as + // its size, if it is less than the size of the section. if (sym_size == 0 || size_to_next_symbol < sym_size) { sym_size = size_to_next_symbol; } @@ -958,8 +946,7 @@ void Symtab::CalculateSymbolSizes() { for (size_t i = 0; i < num_entries; ++i) { // The entries in the m_file_addr_to_index have calculated the sizes - // already - // so we will use this size if we need to. + // already so we will use this size if we need to. const FileRangeToIndexMap::Entry &entry = m_file_addr_to_index.GetEntryRef(i); @@ -1086,8 +1073,8 @@ size_t Symtab::FindFunctionSymbols(const ConstString &name, } if (name_type_mask & eFunctionNameTypeBase) { - // From mangled names we can't tell what is a basename and what - // is a method name, so we just treat them the same + // From mangled names we can't tell what is a basename and what is a method + // name, so we just treat them the same if (!m_name_indexes_computed) InitNameIndexes(); diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index 53bf3e85005..b62c55f76e2 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -387,8 +387,8 @@ bool Type::DumpValueInMemory(ExecutionContext *exe_ctx, Stream *s, bool Type::ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr, AddressType address_type, DataExtractor &data) { if (address_type == eAddressTypeFile) { - // Can't convert a file address to anything valid without more - // context (which Module it came from) + // Can't convert a file address to anything valid without more context + // (which Module it came from) return false; } @@ -533,10 +533,8 @@ bool Type::ResolveClangType(ResolveState compiler_type_resolve_state) { } // When we have a EncodingUID, our "m_flags.compiler_type_resolve_state" is - // set to eResolveStateUnresolved - // so we need to update it to say that we now have a forward declaration - // since that is what we created - // above. + // set to eResolveStateUnresolved so we need to update it to say that we + // now have a forward declaration since that is what we created above. if (m_compiler_type.IsValid()) m_flags.compiler_type_resolve_state = eResolveStateForward; } @@ -556,8 +554,8 @@ bool Type::ResolveClangType(ResolveState compiler_type_resolve_state) { } } - // If we have an encoding type, then we need to make sure it is - // resolved appropriately. + // If we have an encoding type, then we need to make sure it is resolved + // appropriately. if (m_encoding_uid != LLDB_INVALID_UID) { if (encoding_type == nullptr) encoding_type = GetEncodingType(); @@ -847,35 +845,26 @@ TypeImpl &TypeImpl::operator=(const TypeImpl &rhs) { } bool TypeImpl::CheckModule(lldb::ModuleSP &module_sp) const { - // Check if we have a module for this type. If we do and the shared pointer is - // can be successfully initialized with m_module_wp, return true. Else return - // false - // if we didn't have a module, or if we had a module and it has been deleted. - // Any - // functions doing anything with a TypeSP in this TypeImpl class should call - // this - // function and only do anything with the ivars if this function returns true. - // If - // we have a module, the "module_sp" will be filled in with a strong reference - // to the - // module so that the module will at least stay around long enough for the - // type - // query to succeed. + // Check if we have a module for this type. If we do and the shared pointer + // is can be successfully initialized with m_module_wp, return true. Else + // return false if we didn't have a module, or if we had a module and it has + // been deleted. Any functions doing anything with a TypeSP in this TypeImpl + // class should call this function and only do anything with the ivars if + // this function returns true. If we have a module, the "module_sp" will be + // filled in with a strong reference to the module so that the module will at + // least stay around long enough for the type query to succeed. module_sp = m_module_wp.lock(); if (!module_sp) { lldb::ModuleWP empty_module_wp; // If either call to "std::weak_ptr::owner_before(...) value returns true, - // this - // indicates that m_module_wp once contained (possibly still does) a - // reference - // to a valid shared pointer. This helps us know if we had a valid reference - // to - // a section which is now invalid because the module it was in was deleted + // this indicates that m_module_wp once contained (possibly still does) a + // reference to a valid shared pointer. This helps us know if we had a + // valid reference to a section which is now invalid because the module it + // was in was deleted if (empty_module_wp.owner_before(m_module_wp) || m_module_wp.owner_before(empty_module_wp)) { // m_module_wp had a valid reference to a module, but all strong - // references - // have been released and the module has been deleted + // references have been released and the module has been deleted return false; } } diff --git a/lldb/source/Symbol/TypeList.cpp b/lldb/source/Symbol/TypeList.cpp index 4fcaff3daf9..274f721079e 100644 --- a/lldb/source/Symbol/TypeList.cpp +++ b/lldb/source/Symbol/TypeList.cpp @@ -32,7 +32,8 @@ TypeList::TypeList() : m_types() {} TypeList::~TypeList() {} void TypeList::Insert(const TypeSP &type_sp) { - // Just push each type on the back for now. We will worry about uniquing later + // Just push each type on the back for now. We will worry about uniquing + // later if (type_sp) m_types.push_back(type_sp); } @@ -123,10 +124,10 @@ void TypeList::RemoveMismatchedTypes(const char *qualified_typename, void TypeList::RemoveMismatchedTypes(const std::string &type_scope, const std::string &type_basename, TypeClass type_class, bool exact_match) { - // Our "collection" type currently is a std::map which doesn't - // have any good way to iterate and remove items from the map - // so we currently just make a new list and add all of the matching - // types to it, and then swap it into m_types at the end + // Our "collection" type currently is a std::map which doesn't have any good + // way to iterate and remove items from the map so we currently just make a + // new list and add all of the matching types to it, and then swap it into + // m_types at the end collection matching_types; iterator pos, end = m_types.end(); @@ -161,19 +162,15 @@ void TypeList::RemoveMismatchedTypes(const std::string &type_scope, if (type_scope_pos == match_type_scope_size - type_scope_size) { if (type_scope_pos >= 2) { // Our match scope ends with the type scope we were looking - // for, - // but we need to make sure what comes before the matching - // type scope is a namespace boundary in case we are trying to - // match: - // type_basename = "d" - // type_scope = "b::c::" + // for, but we need to make sure what comes before the + // matching type scope is a namespace boundary in case we are + // trying to match: type_basename = "d" type_scope = "b::c::" // We want to match: // match_type_scope "a::b::c::" // But not: // match_type_scope "a::bb::c::" // So below we make sure what comes before "b::c::" in - // match_type_scope - // is "::", or the namespace boundary + // match_type_scope is "::", or the namespace boundary if (match_type_scope[type_scope_pos - 1] == ':' && match_type_scope[type_scope_pos - 2] == ':') { keep_match = true; @@ -184,9 +181,8 @@ void TypeList::RemoveMismatchedTypes(const std::string &type_scope, } } } else { - // The type we are currently looking at doesn't exists - // in a namespace or class, so it only matches if there - // is no type scope... + // The type we are currently looking at doesn't exists in a namespace + // or class, so it only matches if there is no type scope... keep_match = type_scope.empty() && type_basename.compare(match_type_name) == 0; } @@ -203,10 +199,10 @@ void TypeList::RemoveMismatchedTypes(TypeClass type_class) { if (type_class == eTypeClassAny) return; - // Our "collection" type currently is a std::map which doesn't - // have any good way to iterate and remove items from the map - // so we currently just make a new list and add all of the matching - // types to it, and then swap it into m_types at the end + // Our "collection" type currently is a std::map which doesn't have any good + // way to iterate and remove items from the map so we currently just make a + // new list and add all of the matching types to it, and then swap it into + // m_types at the end collection matching_types; iterator pos, end = m_types.end(); diff --git a/lldb/source/Symbol/TypeMap.cpp b/lldb/source/Symbol/TypeMap.cpp index 40c6558d582..2838039ad60 100644 --- a/lldb/source/Symbol/TypeMap.cpp +++ b/lldb/source/Symbol/TypeMap.cpp @@ -45,7 +45,8 @@ TypeMap::TypeMap() : m_types() {} TypeMap::~TypeMap() {} void TypeMap::Insert(const TypeSP &type_sp) { - // Just push each type on the back for now. We will worry about uniquing later + // Just push each type on the back for now. We will worry about uniquing + // later if (type_sp) m_types.insert(std::make_pair(type_sp->GetID(), type_sp)); } @@ -167,10 +168,10 @@ void TypeMap::RemoveMismatchedTypes(const char *qualified_typename, void TypeMap::RemoveMismatchedTypes(const std::string &type_scope, const std::string &type_basename, TypeClass type_class, bool exact_match) { - // Our "collection" type currently is a std::map which doesn't - // have any good way to iterate and remove items from the map - // so we currently just make a new list and add all of the matching - // types to it, and then swap it into m_types at the end + // Our "collection" type currently is a std::map which doesn't have any good + // way to iterate and remove items from the map so we currently just make a + // new list and add all of the matching types to it, and then swap it into + // m_types at the end collection matching_types; iterator pos, end = m_types.end(); @@ -205,19 +206,15 @@ void TypeMap::RemoveMismatchedTypes(const std::string &type_scope, if (type_scope_pos == match_type_scope_size - type_scope_size) { if (type_scope_pos >= 2) { // Our match scope ends with the type scope we were looking - // for, - // but we need to make sure what comes before the matching - // type scope is a namespace boundary in case we are trying to - // match: - // type_basename = "d" - // type_scope = "b::c::" + // for, but we need to make sure what comes before the + // matching type scope is a namespace boundary in case we are + // trying to match: type_basename = "d" type_scope = "b::c::" // We want to match: // match_type_scope "a::b::c::" // But not: // match_type_scope "a::bb::c::" // So below we make sure what comes before "b::c::" in - // match_type_scope - // is "::", or the namespace boundary + // match_type_scope is "::", or the namespace boundary if (match_type_scope[type_scope_pos - 1] == ':' && match_type_scope[type_scope_pos - 2] == ':') { keep_match = true; @@ -228,9 +225,8 @@ void TypeMap::RemoveMismatchedTypes(const std::string &type_scope, } } } else { - // The type we are currently looking at doesn't exists - // in a namespace or class, so it only matches if there - // is no type scope... + // The type we are currently looking at doesn't exists in a namespace + // or class, so it only matches if there is no type scope... keep_match = type_scope.empty() && type_basename.compare(match_type_name) == 0; } @@ -247,10 +243,10 @@ void TypeMap::RemoveMismatchedTypes(TypeClass type_class) { if (type_class == eTypeClassAny) return; - // Our "collection" type currently is a std::map which doesn't - // have any good way to iterate and remove items from the map - // so we currently just make a new list and add all of the matching - // types to it, and then swap it into m_types at the end + // Our "collection" type currently is a std::map which doesn't have any good + // way to iterate and remove items from the map so we currently just make a + // new list and add all of the matching types to it, and then swap it into + // m_types at the end collection matching_types; iterator pos, end = m_types.end(); diff --git a/lldb/source/Symbol/UnwindPlan.cpp b/lldb/source/Symbol/UnwindPlan.cpp index 4c0014348c4..23ca1324ab0 100644 --- a/lldb/source/Symbol/UnwindPlan.cpp +++ b/lldb/source/Symbol/UnwindPlan.cpp @@ -46,8 +46,7 @@ operator==(const UnwindPlan::Row::RegisterLocation &rhs) const { } // This function doesn't copy the dwarf expression bytes; they must remain in -// allocated -// memory for the lifespan of this UnwindPlan object. +// allocated memory for the lifespan of this UnwindPlan object. void UnwindPlan::Row::RegisterLocation::SetAtDWARFExpression( const uint8_t *opcodes, uint32_t len) { m_type = atDWARFExpression; @@ -56,8 +55,7 @@ void UnwindPlan::Row::RegisterLocation::SetAtDWARFExpression( } // This function doesn't copy the dwarf expression bytes; they must remain in -// allocated -// memory for the lifespan of this UnwindPlan object. +// allocated memory for the lifespan of this UnwindPlan object. void UnwindPlan::Row::RegisterLocation::SetIsDWARFExpression( const uint8_t *opcodes, uint32_t len) { m_type = isDWARFExpression; diff --git a/lldb/source/Symbol/UnwindTable.cpp b/lldb/source/Symbol/UnwindTable.cpp index 405d57754ea..7f98eaca252 100644 --- a/lldb/source/Symbol/UnwindTable.cpp +++ b/lldb/source/Symbol/UnwindTable.cpp @@ -20,10 +20,9 @@ #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolContext.h" -// There is one UnwindTable object per ObjectFile. -// It contains a list of Unwind objects -- one per function, populated lazily -- -// for the ObjectFile. -// Each Unwind object has multiple UnwindPlans for different scenarios. +// There is one UnwindTable object per ObjectFile. It contains a list of Unwind +// objects -- one per function, populated lazily -- for the ObjectFile. Each +// Unwind object has multiple UnwindPlans for different scenarios. using namespace lldb; using namespace lldb_private; @@ -33,8 +32,7 @@ UnwindTable::UnwindTable(ObjectFile &objfile) m_eh_frame_up(), m_compact_unwind_up(), m_arm_unwind_up() {} // We can't do some of this initialization when the ObjectFile is running its -// ctor; delay doing it -// until needed for something. +// ctor; delay doing it until needed for something. void UnwindTable::Initialize() { if (m_initialized) @@ -134,10 +132,9 @@ UnwindTable::GetFuncUnwindersContainingAddress(const Address &addr, } // Ignore any existing FuncUnwinders for this function, create a new one and -// don't add it to the -// UnwindTable. This is intended for use by target modules show-unwind where we -// want to create -// new UnwindPlans, not re-use existing ones. +// don't add it to the UnwindTable. This is intended for use by target modules +// show-unwind where we want to create new UnwindPlans, not re-use existing +// ones. FuncUnwindersSP UnwindTable::GetUncachedFuncUnwindersContainingAddress(const Address &addr, SymbolContext &sc) { diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp index 1957bcef1f3..4aa6a717c15 100644 --- a/lldb/source/Symbol/Variable.cpp +++ b/lldb/source/Symbol/Variable.cpp @@ -239,9 +239,8 @@ bool Variable::LocationIsValidForFrame(StackFrame *frame) { target_sp.get()); if (loclist_base_load_addr == LLDB_INVALID_ADDRESS) return false; - // It is a location list. We just need to tell if the location - // list contains the current address when converted to a load - // address + // It is a location list. We just need to tell if the location list + // contains the current address when converted to a load address return m_location.LocationListContainsAddress( loclist_base_load_addr, frame->GetFrameCodeAddress().GetLoadAddress(target_sp.get())); @@ -251,8 +250,8 @@ bool Variable::LocationIsValidForFrame(StackFrame *frame) { } bool Variable::LocationIsValidForAddress(const Address &address) { - // Be sure to resolve the address to section offset prior to - // calling this function. + // Be sure to resolve the address to section offset prior to calling this + // function. if (address.IsSectionOffset()) { SymbolContext sc; CalculateSymbolContext(&sc); @@ -268,9 +267,8 @@ bool Variable::LocationIsValidForAddress(const Address &address) { sc.function->GetAddressRange().GetBaseAddress().GetFileAddress(); if (loclist_base_file_addr == LLDB_INVALID_ADDRESS) return false; - // It is a location list. We just need to tell if the location - // list contains the current address when converted to a load - // address + // It is a location list. We just need to tell if the location list + // contains the current address when converted to a load address return m_location.LocationListContainsAddress(loclist_base_file_addr, address.GetFileAddress()); } @@ -294,8 +292,8 @@ bool Variable::IsInScope(StackFrame *frame) { case eValueTypeVariableArgument: case eValueTypeVariableLocal: if (frame) { - // We don't have a location list, we just need to see if the block - // that this variable was defined in is currently + // We don't have a location list, we just need to see if the block that + // this variable was defined in is currently Block *deepest_frame_block = frame->GetSymbolContext(eSymbolContextBlock).block; if (deepest_frame_block) { @@ -313,8 +311,7 @@ bool Variable::IsInScope(StackFrame *frame) { return false; // If no scope range is specified then it means that the scope is the - // same as the - // scope of the enclosing lexical block. + // same as the scope of the enclosing lexical block. if (m_scope_range.IsEmpty()) return true; @@ -455,8 +452,8 @@ Status Variable::GetValuesForVariableExpressionPath( } bool Variable::DumpLocationForAddress(Stream *s, const Address &address) { - // Be sure to resolve the address to section offset prior to - // calling this function. + // Be sure to resolve the address to section offset prior to calling this + // function. if (address.IsSectionOffset()) { SymbolContext sc; CalculateSymbolContext(&sc); |