1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

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
This commit is contained in:
Frederic Riss 2014-09-04 06:14:35 +00:00
parent d7744d5ca6
commit 3abfc56bb1
2 changed files with 10 additions and 1 deletions

View File

@ -70,6 +70,7 @@ public:
Optional<const char *> getAsCString(const DWARFUnit *U) const;
Optional<uint64_t> getAsAddress(const DWARFUnit *U) const;
Optional<uint64_t> getAsSectionOffset() const;
Optional<ArrayRef<const uint8_t>> getAsBlock() const;
bool skipValue(DataExtractor debug_info_data, uint32_t *offset_ptr,
const DWARFUnit *u) const;

View File

@ -543,7 +543,15 @@ Optional<uint64_t> DWARFFormValue::getAsSectionOffset() const {
}
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);
}