diff options
author | Frederic Riss <friss@apple.com> | 2014-09-04 06:14:35 +0000 |
---|---|---|
committer | Frederic Riss <friss@apple.com> | 2014-09-04 06:14:35 +0000 |
commit | f3549a239617ef01422d5b77970477963d1c9ba0 (patch) | |
tree | 55259980c72a578fcbe5b92dc8c018cf8f27014a /llvm/lib/DebugInfo/DWARFFormValue.cpp | |
parent | e10ccef9b329fdf4f8c59a5f6e88beb9354c2c49 (diff) | |
download | llvm-f3549a239617ef01422d5b77970477963d1c9ba0.zip llvm-f3549a239617ef01422d5b77970477963d1c9ba0.tar.gz llvm-f3549a239617ef01422d5b77970477963d1c9ba0.tar.bz2 |
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
Diffstat (limited to 'llvm/lib/DebugInfo/DWARFFormValue.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARFFormValue.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
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::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); +} + |