diff options
author | Wolfgang Pieb <Wolfgang.Pieb@sony.com> | 2018-10-31 21:05:51 +0000 |
---|---|---|
committer | Wolfgang Pieb <Wolfgang.Pieb@sony.com> | 2018-10-31 21:05:51 +0000 |
commit | 8eb3c8145793446acd1ba01530b64a03242d0e91 (patch) | |
tree | 7fd4f7ea0686b67df23edbf7226c5cd96faa8801 /llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | |
parent | e7cb0225a0882c1595f2279b0c6045a96f61b78d (diff) | |
download | bcm5719-llvm-8eb3c8145793446acd1ba01530b64a03242d0e91.tar.gz bcm5719-llvm-8eb3c8145793446acd1ba01530b64a03242d0e91.zip |
[DWARF][NFC] Refactor a function to return Optional<> instead of bool
Minor refactor of DWARFUnit::getStringOffsetSectionItem().
Differential Revision: https://reviews.llvm.org/D53948
llvm-svn: 345776
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp index d475c44c393..1caaa249bef 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -217,18 +217,16 @@ DWARFUnit::getAddrOffsetSectionItem(uint32_t Index) const { return {{Address, Section}}; } -bool DWARFUnit::getStringOffsetSectionItem(uint32_t Index, - uint64_t &Result) const { +Optional<uint64_t> DWARFUnit::getStringOffsetSectionItem(uint32_t Index) const { if (!StringOffsetsTableContribution) - return false; + return None; unsigned ItemSize = getDwarfStringOffsetsByteSize(); uint32_t Offset = getStringOffsetsBase() + Index * ItemSize; if (StringOffsetSection.Data.size() < Offset + ItemSize) - return false; + return None; DWARFDataExtractor DA(Context.getDWARFObj(), StringOffsetSection, isLittleEndian, 0); - Result = DA.getRelocatedValue(ItemSize, &Offset); - return true; + return DA.getRelocatedValue(ItemSize, &Offset); } bool DWARFUnitHeader::extract(DWARFContext &Context, |