Fix llvm-symbolizer to navigate both DW_AT_abstract_origin and DW_AT_specification in a single chain
In a recent refactoring (r291959) this regressed to only following one
or the other, not both, in a single chain.
llvm-svn: 297676
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
index fc49fde..4308cc2 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -150,21 +150,6 @@
}
Optional<DWARFFormValue>
-DWARFDie::findRecursively(dwarf::Attribute Attr) const {
- if (!isValid())
- return None;
- if (auto Value = find(Attr))
- return Value;
- if (auto Die = getAttributeValueAsReferencedDie(DW_AT_abstract_origin))
- if (auto Value = Die.find(Attr))
- return Value;
- if (auto Die = getAttributeValueAsReferencedDie(DW_AT_specification))
- if (auto Value = Die.find(Attr))
- return Value;
- return None;
-}
-
-Optional<DWARFFormValue>
DWARFDie::find(ArrayRef<dwarf::Attribute> Attrs) const {
if (!isValid())
return None;
@@ -182,14 +167,17 @@
DWARFDie::findRecursively(ArrayRef<dwarf::Attribute> Attrs) const {
if (!isValid())
return None;
- if (auto Value = find(Attrs))
+ auto Die = *this;
+ if (auto Value = Die.find(Attrs))
return Value;
- if (auto Die = getAttributeValueAsReferencedDie(DW_AT_abstract_origin))
- if (auto Value = Die.find(Attrs))
- return Value;
- if (auto Die = getAttributeValueAsReferencedDie(DW_AT_specification))
- if (auto Value = Die.find(Attrs))
- return Value;
+ if (auto D = Die.getAttributeValueAsReferencedDie(DW_AT_abstract_origin))
+ Die = D;
+ if (auto Value = Die.find(Attrs))
+ return Value;
+ if (auto D = Die.getAttributeValueAsReferencedDie(DW_AT_specification))
+ Die = D;
+ if (auto Value = Die.find(Attrs))
+ return Value;
return None;
}