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
diff --git a/llvm/tools/dsymutil/DwarfLinker.cpp b/llvm/tools/dsymutil/DwarfLinker.cpp
index 6818ed2..068bf22 100644
--- a/llvm/tools/dsymutil/DwarfLinker.cpp
+++ b/llvm/tools/dsymutil/DwarfLinker.cpp
@@ -2136,19 +2136,19 @@
Flags |= TF_Keep;
- DWARFFormValue HighPcValue;
- if (!DIE.getAttributeValue(dwarf::DW_AT_high_pc, HighPcValue)) {
+ Optional<DWARFFormValue> HighPcValue;
+ if (!(HighPcValue = DIE.getAttributeValue(dwarf::DW_AT_high_pc))) {
reportWarning("Function without high_pc. Range will be discarded.\n",
&DIE);
return Flags;
}
uint64_t HighPc;
- if (HighPcValue.isFormClass(DWARFFormValue::FC_Address)) {
- HighPc = *HighPcValue.getAsAddress();
+ if (HighPcValue->isFormClass(DWARFFormValue::FC_Address)) {
+ HighPc = *HighPcValue->getAsAddress();
} else {
- assert(HighPcValue.isFormClass(DWARFFormValue::FC_Constant));
- HighPc = LowPc + *HighPcValue.getAsUnsignedConstant();
+ assert(HighPcValue->isFormClass(DWARFFormValue::FC_Constant));
+ HighPc = LowPc + *HighPcValue->getAsUnsignedConstant();
}
// Replace the debug map range with a more accurate one.