summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
diff options
context:
space:
mode:
authorWolfgang Pieb <Wolfgang.Pieb@sony.com>2018-10-31 21:05:51 +0000
committerWolfgang Pieb <Wolfgang.Pieb@sony.com>2018-10-31 21:05:51 +0000
commit8eb3c8145793446acd1ba01530b64a03242d0e91 (patch)
tree7fd4f7ea0686b67df23edbf7226c5cd96faa8801 /llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
parente7cb0225a0882c1595f2279b0c6045a96f61b78d (diff)
downloadbcm5719-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/DWARFFormValue.cpp')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
index ed510a0e4cd..9226dcad39a 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
@@ -542,10 +542,12 @@ Optional<const char *> DWARFFormValue::getAsCString() const {
if (Form == DW_FORM_GNU_str_index || Form == DW_FORM_strx ||
Form == DW_FORM_strx1 || Form == DW_FORM_strx2 || Form == DW_FORM_strx3 ||
Form == DW_FORM_strx4) {
- uint64_t StrOffset;
- if (!U || !U->getStringOffsetSectionItem(Offset, StrOffset))
+ if (!U)
+ return None;
+ Optional<uint64_t> StrOffset = U->getStringOffsetSectionItem(Offset);
+ if (!StrOffset)
return None;
- Offset = StrOffset;
+ Offset = *StrOffset;
}
// Prefer the Unit's string extractor, because for .dwo it will point to
// .debug_str.dwo, while the Context's extractor always uses .debug_str.
OpenPOWER on IntegriCloud