Switch all DWARF variables for tags, attributes and forms over to use the llvm::dwarf enumerations instead of using raw uint16_t values. This allows easier debugging as users can see the values of the enumerations in the variables view that will show the enumeration string instead of just a number.
https://reviews.llvm.org/D26013
llvm-svn: 285309
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
index c43456b..e4577dc 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp
@@ -112,7 +112,8 @@
void DWARFDebugInfoEntryMinimal::dumpAttribute(raw_ostream &OS,
DWARFUnit *u,
uint32_t *offset_ptr,
- uint16_t attr, uint16_t form,
+ dwarf::Attribute attr,
+ dwarf::Form form,
unsigned indent) const {
const char BaseIndent[] = " ";
OS << BaseIndent;
@@ -207,7 +208,7 @@
// Skip all data in the .debug_info for the attributes
for (const auto &AttrSpec : AbbrevDecl->attributes()) {
- uint16_t Form = AttrSpec.Form;
+ auto Form = AttrSpec.Form;
uint8_t FixedFormSize =
(Form < FixedFormSizes.size()) ? FixedFormSizes[Form] : 0;
@@ -232,8 +233,8 @@
Tag == DW_TAG_inlined_subroutine;
}
-bool DWARFDebugInfoEntryMinimal::getAttributeValue(
- const DWARFUnit *U, const uint16_t Attr, DWARFFormValue &FormValue) const {
+bool DWARFDebugInfoEntryMinimal::getAttributeValue(const DWARFUnit *U,
+ dwarf::Attribute Attr, DWARFFormValue &FormValue) const {
if (!AbbrevDecl)
return false;
@@ -258,7 +259,8 @@
}
const char *DWARFDebugInfoEntryMinimal::getAttributeValueAsString(
- const DWARFUnit *U, const uint16_t Attr, const char *FailValue) const {
+ const DWARFUnit *U, dwarf::Attribute Attr,
+ const char *FailValue) const {
DWARFFormValue FormValue;
if (!getAttributeValue(U, Attr, FormValue))
return FailValue;
@@ -267,7 +269,8 @@
}
uint64_t DWARFDebugInfoEntryMinimal::getAttributeValueAsAddress(
- const DWARFUnit *U, const uint16_t Attr, uint64_t FailValue) const {
+ const DWARFUnit *U, dwarf::Attribute Attr,
+ uint64_t FailValue) const {
DWARFFormValue FormValue;
if (!getAttributeValue(U, Attr, FormValue))
return FailValue;
@@ -276,7 +279,8 @@
}
uint64_t DWARFDebugInfoEntryMinimal::getAttributeValueAsUnsignedConstant(
- const DWARFUnit *U, const uint16_t Attr, uint64_t FailValue) const {
+ const DWARFUnit *U, dwarf::Attribute Attr,
+ uint64_t FailValue) const {
DWARFFormValue FormValue;
if (!getAttributeValue(U, Attr, FormValue))
return FailValue;
@@ -285,7 +289,8 @@
}
uint64_t DWARFDebugInfoEntryMinimal::getAttributeValueAsReference(
- const DWARFUnit *U, const uint16_t Attr, uint64_t FailValue) const {
+ const DWARFUnit *U, dwarf::Attribute Attr,
+ uint64_t FailValue) const {
DWARFFormValue FormValue;
if (!getAttributeValue(U, Attr, FormValue))
return FailValue;
@@ -294,7 +299,8 @@
}
uint64_t DWARFDebugInfoEntryMinimal::getAttributeValueAsSectionOffset(
- const DWARFUnit *U, const uint16_t Attr, uint64_t FailValue) const {
+ const DWARFUnit *U, dwarf::Attribute Attr,
+ uint64_t FailValue) const {
DWARFFormValue FormValue;
if (!getAttributeValue(U, Attr, FormValue))
return FailValue;