summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2016-12-13 23:20:56 +0000
committerGreg Clayton <gclayton@apple.com>2016-12-13 23:20:56 +0000
commit1cbf3fa94a6ef7a3dd4f5d177aeed5ea3fa539bc (patch)
treee7878576b7b64074b8144a8ef3b233c2962711c5 /llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
parent98d40e0557290d7b17533ed86a5ce41f90ff1626 (diff)
downloadbcm5719-llvm-1cbf3fa94a6ef7a3dd4f5d177aeed5ea3fa539bc.tar.gz
bcm5719-llvm-1cbf3fa94a6ef7a3dd4f5d177aeed5ea3fa539bc.zip
Switch functions that returned bool and filled in a DWARFFormValue arg with ones that return Optional<DWARFFormValue>
Differential Revision: https://reviews.llvm.org/D27737 llvm-svn: 289611
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
index 638830ee568..6126470aa09 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
@@ -143,12 +143,12 @@ DWARFAbbreviationDeclaration::findAttributeIndex(dwarf::Attribute Attr) const {
return None;
}
-bool DWARFAbbreviationDeclaration::getAttributeValue(
- const uint32_t DIEOffset, const dwarf::Attribute Attr, const DWARFUnit &U,
- DWARFFormValue &FormValue) const {
+Optional<DWARFFormValue> DWARFAbbreviationDeclaration::getAttributeValue(
+ const uint32_t DIEOffset, const dwarf::Attribute Attr,
+ const DWARFUnit &U) const {
Optional<uint32_t> MatchAttrIndex = findAttributeIndex(Attr);
if (!MatchAttrIndex)
- return false;
+ return None;
auto DebugInfoData = U.getDebugInfoExtractor();
@@ -159,8 +159,9 @@ bool DWARFAbbreviationDeclaration::getAttributeValue(
for (const auto &Spec : AttributeSpecs) {
if (*MatchAttrIndex == AttrIndex) {
// We have arrived at the attribute to extract, extract if from Offset.
- FormValue.setForm(Spec.Form);
- return FormValue.extractValue(DebugInfoData, &Offset, &U);
+ DWARFFormValue FormValue(Spec.Form);
+ if (FormValue.extractValue(DebugInfoData, &Offset, &U))
+ return FormValue;
}
// March Offset along until we get to the attribute we want.
if (Optional<uint8_t> FixedSize = Spec.getByteSize(U))
@@ -169,7 +170,7 @@ bool DWARFAbbreviationDeclaration::getAttributeValue(
DWARFFormValue::skipValue(Spec.Form, DebugInfoData, &Offset, &U);
++AttrIndex;
}
- return false;
+ return None;
}
size_t DWARFAbbreviationDeclaration::FixedSizeInfo::getByteSize(
OpenPOWER on IntegriCloud