[llvm] r217129 - Add DWARFFormValue::getAsBlock() and add FC_Flag as an acceptable class for an unsigned constant.

Frederic Riss friss at apple.com
Wed Sep 3 23:14:35 PDT 2014


Author: friss
Date: Thu Sep  4 01:14:35 2014
New Revision: 217129

URL: http://llvm.org/viewvc/llvm-project?rev=217129&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/DebugInfo/DWARFFormValue.h
    llvm/trunk/lib/DebugInfo/DWARFFormValue.cpp

Modified: llvm/trunk/include/llvm/DebugInfo/DWARFFormValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARFFormValue.h?rev=217129&r1=217128&r2=217129&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARFFormValue.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARFFormValue.h Thu Sep  4 01:14:35 2014
@@ -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;

Modified: llvm/trunk/lib/DebugInfo/DWARFFormValue.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFFormValue.cpp?rev=217129&r1=217128&r2=217129&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARFFormValue.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARFFormValue.cpp Thu Sep  4 01:14:35 2014
@@ -543,7 +543,15 @@ Optional<uint64_t> DWARFFormValue::getAs
 }
 
 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);
+}
+





More information about the llvm-commits mailing list