From b7b34f85c55fa3337eeca9a90e5c66db088fcde4 Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Wed, 4 Oct 2017 22:26:19 +0000 Subject: [PATCH] clang-format file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314942 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/DebugInfo/DWARF/DWARFDie.cpp | 57 +++++++++++++++----------------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/lib/DebugInfo/DWARF/DWARFDie.cpp b/lib/DebugInfo/DWARF/DWARFDie.cpp index d4c55aa7b56..d2890d6139d 100644 --- a/lib/DebugInfo/DWARF/DWARFDie.cpp +++ b/lib/DebugInfo/DWARF/DWARFDie.cpp @@ -132,7 +132,7 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, return; const char BaseIndent[] = " "; OS << BaseIndent; - OS.indent(Indent+2); + OS.indent(Indent + 2); auto attrString = AttributeString(Attr); if (!attrString.empty()) WithColor(OS, syntax::Attribute) << attrString; @@ -161,7 +161,10 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, if (Attr == DW_AT_decl_file || Attr == DW_AT_call_file) { Color = syntax::String; if (const auto *LT = U->getContext().getLineTableForUnit(U)) - if (LT->getFileNameByIndex(formValue.getAsUnsignedConstant().getValue(), U->getCompilationDir(), DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, File)) { + if (LT->getFileNameByIndex( + formValue.getAsUnsignedConstant().getValue(), + U->getCompilationDir(), + DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath, File)) { File = '"' + File + '"'; Name = File; } @@ -182,8 +185,9 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, // having both the raw value and the pretty-printed value is // interesting. These attributes are handled below. if (Attr == DW_AT_specification || Attr == DW_AT_abstract_origin) { - if (const char *Name = Die.getAttributeValueAsReferencedDie(Attr).getName(DINameKind::LinkageName)) - OS << " \"" << Name << '\"'; + if (const char *Name = Die.getAttributeValueAsReferencedDie(Attr).getName( + DINameKind::LinkageName)) + OS << " \"" << Name << '\"'; } else if (Attr == DW_AT_APPLE_property_attribute) { if (Optional OptVal = formValue.getAsUnsignedConstant()) dumpApplePropertyAttribute(OS, *OptVal); @@ -196,17 +200,14 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die, OS << ")\n"; } -bool DWARFDie::isSubprogramDIE() const { - return getTag() == DW_TAG_subprogram; -} +bool DWARFDie::isSubprogramDIE() const { return getTag() == DW_TAG_subprogram; } bool DWARFDie::isSubroutineDIE() const { auto Tag = getTag(); return Tag == DW_TAG_subprogram || Tag == DW_TAG_inlined_subroutine; } -Optional -DWARFDie::find(dwarf::Attribute Attr) const { +Optional DWARFDie::find(dwarf::Attribute Attr) const { if (!isValid()) return None; auto AbbrevDecl = getAbbreviationDeclarationPtr(); @@ -258,8 +259,7 @@ DWARFDie::getAttributeValueAsReferencedDie(dwarf::Attribute Attr) const { return DWARFDie(); } -Optional -DWARFDie::getRangesBaseAttribute() const { +Optional DWARFDie::getRangesBaseAttribute() const { return toSectionOffset(find({DW_AT_rnglists_base, DW_AT_GNU_ranges_base})); } @@ -292,8 +292,7 @@ bool DWARFDie::getLowAndHighPC(uint64_t &LowPC, uint64_t &HighPC, return false; } -DWARFAddressRangesVector -DWARFDie::getAddressRanges() const { +DWARFAddressRangesVector DWARFDie::getAddressRanges() const { if (isNULL()) return DWARFAddressRangesVector(); // Single range specified by low/high PC. @@ -311,8 +310,8 @@ DWARFDie::getAddressRanges() const { return DWARFAddressRangesVector(); } -void -DWARFDie::collectChildrenAddressRanges(DWARFAddressRangesVector& Ranges) const { +void DWARFDie::collectChildrenAddressRanges( + DWARFAddressRangesVector &Ranges) const { if (isNULL()) return; if (isSubprogramDIE()) { @@ -320,33 +319,32 @@ DWARFDie::collectChildrenAddressRanges(DWARFAddressRangesVector& Ranges) const { Ranges.insert(Ranges.end(), DIERanges.begin(), DIERanges.end()); } - for (auto Child: children()) + for (auto Child : children()) Child.collectChildrenAddressRanges(Ranges); } bool DWARFDie::addressRangeContainsAddress(const uint64_t Address) const { - for (const auto& R : getAddressRanges()) { + for (const auto &R : getAddressRanges()) { if (R.LowPC <= Address && Address < R.HighPC) return true; } return false; } -const char * -DWARFDie::getSubroutineName(DINameKind Kind) const { +const char *DWARFDie::getSubroutineName(DINameKind Kind) const { if (!isSubroutineDIE()) return nullptr; return getName(Kind); } -const char * -DWARFDie::getName(DINameKind Kind) const { +const char *DWARFDie::getName(DINameKind Kind) const { if (!isValid() || Kind == DINameKind::None) return nullptr; // Try to get mangled name only if it was asked for. if (Kind == DINameKind::LinkageName) { - if (auto Name = dwarf::toString(findRecursively({DW_AT_MIPS_linkage_name, - DW_AT_linkage_name}), nullptr)) + if (auto Name = dwarf::toString( + findRecursively({DW_AT_MIPS_linkage_name, DW_AT_linkage_name}), + nullptr)) return Name; } if (auto Name = dwarf::toString(findRecursively(DW_AT_name), nullptr)) @@ -401,7 +399,7 @@ void DWARFDie::dump(raw_ostream &OS, unsigned Indent, WithColor(OS, syntax::Tag).get().indent(Indent) << tagString; else WithColor(OS, syntax::Tag).get().indent(Indent) - << format("DW_TAG_Unknown_%x", getTag()); + << format("DW_TAG_Unknown_%x", getTag()); if (DumpOpts.Verbose) OS << format(" [%u] %c", abbrCode, @@ -424,13 +422,13 @@ void DWARFDie::dump(raw_ostream &OS, unsigned Indent, if (DumpOpts.RecurseDepth > 0 && child) { DumpOpts.RecurseDepth--; while (child) { - child.dump(OS, Indent+2, DumpOpts); + child.dump(OS, Indent + 2, DumpOpts); child = child.getSibling(); } } } else { OS << "Abbreviation code not found in 'debug_abbrev' class for code: " - << abbrCode << '\n'; + << abbrCode << '\n'; } } else { OS.indent(Indent) << "NULL\n"; @@ -452,14 +450,13 @@ DWARFDie DWARFDie::getSibling() const { return DWARFDie(); } -iterator_range -DWARFDie::attributes() const { +iterator_range DWARFDie::attributes() const { return make_range(attribute_iterator(*this, false), attribute_iterator(*this, true)); } -DWARFDie::attribute_iterator::attribute_iterator(DWARFDie D, bool End) : - Die(D), AttrValue(0), Index(0) { +DWARFDie::attribute_iterator::attribute_iterator(DWARFDie D, bool End) + : Die(D), AttrValue(0), Index(0) { auto AbbrDecl = Die.getAbbreviationDeclarationPtr(); assert(AbbrDecl && "Must have abbreviation declaration"); if (End) { -- 2.40.0