Add DWARFFormValue::getAsBlock() and add FC_Flag as an acceptable class for an unsigned constant.
To be used in further patches that improve the dumpers.
llvm-svn: 217129
diff --git a/llvm/lib/DebugInfo/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARFFormValue.cpp
index 8d0f966..2f8affc 100644
--- a/llvm/lib/DebugInfo/DWARFFormValue.cpp
+++ b/llvm/lib/DebugInfo/DWARFFormValue.cpp
@@ -543,7 +543,15 @@
}
Optional<uint64_t> DWARFFormValue::getAsUnsignedConstant() const {
- if (!isFormClass(FC_Constant) || Form == DW_FORM_sdata)
+ if ((!isFormClass(FC_Constant) && !isFormClass(FC_Flag))
+ || Form == DW_FORM_sdata)
return None;
return Value.uval;
}
+
+Optional<ArrayRef<const uint8_t>> DWARFFormValue::getAsBlock() const {
+ if (!isFormClass(FC_Block) && !isFormClass(FC_Exprloc))
+ return None;
+ return ArrayRef<const uint8_t>(Value.data, Value.uval);
+}
+