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;
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;
}
// 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<uint64_t> OptVal = formValue.getAsUnsignedConstant())
dumpApplePropertyAttribute(OS, *OptVal);
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<DWARFFormValue>
-DWARFDie::find(dwarf::Attribute Attr) const {
+Optional<DWARFFormValue> DWARFDie::find(dwarf::Attribute Attr) const {
if (!isValid())
return None;
auto AbbrevDecl = getAbbreviationDeclarationPtr();
return DWARFDie();
}
-Optional<uint64_t>
-DWARFDie::getRangesBaseAttribute() const {
+Optional<uint64_t> DWARFDie::getRangesBaseAttribute() const {
return toSectionOffset(find({DW_AT_rnglists_base, DW_AT_GNU_ranges_base}));
}
return false;
}
-DWARFAddressRangesVector
-DWARFDie::getAddressRanges() const {
+DWARFAddressRangesVector DWARFDie::getAddressRanges() const {
if (isNULL())
return DWARFAddressRangesVector();
// Single range specified by low/high PC.
return DWARFAddressRangesVector();
}
-void
-DWARFDie::collectChildrenAddressRanges(DWARFAddressRangesVector& Ranges) const {
+void DWARFDie::collectChildrenAddressRanges(
+ DWARFAddressRangesVector &Ranges) const {
if (isNULL())
return;
if (isSubprogramDIE()) {
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))
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,
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";
return DWARFDie();
}
-iterator_range<DWARFDie::attribute_iterator>
-DWARFDie::attributes() const {
+iterator_range<DWARFDie::attribute_iterator> 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) {