summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp6
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp14
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDie.cpp8
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp15
4 files changed, 21 insertions, 22 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
index f607dfe37cb..f4dd7993760 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
@@ -166,8 +166,10 @@ Optional<DWARFFormValue> DWARFAbbreviationDeclaration::getAttributeValue(
if (Spec.isImplicitConst())
return DWARFFormValue::createFromSValue(Spec.Form,
Spec.getImplicitConstValue());
- return DWARFFormValue::createFromData(Spec.Form, U.getFormParams(), U,
- U.getDebugInfoExtractor(), &Offset);
+
+ DWARFFormValue FormValue(Spec.Form);
+ if (FormValue.extractValue(DebugInfoData, &Offset, U.getFormParams(), &U))
+ return FormValue;
}
// March Offset along until we get to the attribute we want.
if (auto FixedSize = Spec.getByteSize(U))
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index 8dbca510d15..a2c25248618 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -212,14 +212,15 @@ parseV5DirFileTables(const DWARFDataExtractor &DebugLineData,
if (*OffsetPtr >= EndPrologueOffset)
return false;
for (auto Descriptor : DirDescriptors) {
+ DWARFFormValue Value(Descriptor.Form);
switch (Descriptor.Type) {
case DW_LNCT_path:
- IncludeDirectories.push_back(DWARFFormValue::createFromData(
- Descriptor.Form, FormParams, *U, DebugLineData, OffsetPtr, &Ctx));
+ if (!Value.extractValue(DebugLineData, OffsetPtr, FormParams, &Ctx, U))
+ return false;
+ IncludeDirectories.push_back(Value);
break;
default:
- if (!DWARFFormValue::skipValue(Descriptor.Form, DebugLineData,
- OffsetPtr, FormParams))
+ if (!Value.skipValue(DebugLineData, OffsetPtr, FormParams))
return false;
}
}
@@ -239,8 +240,9 @@ parseV5DirFileTables(const DWARFDataExtractor &DebugLineData,
return false;
DWARFDebugLine::FileNameEntry FileEntry;
for (auto Descriptor : FileDescriptors) {
- DWARFFormValue Value = DWARFFormValue::createFromData(
- Descriptor.Form, FormParams, *U, DebugLineData, OffsetPtr, &Ctx);
+ DWARFFormValue Value(Descriptor.Form);
+ if (!Value.extractValue(DebugLineData, OffsetPtr, FormParams, &Ctx, U))
+ return false;
switch (Descriptor.Type) {
case DW_LNCT_path:
FileEntry.Name = Value;
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
index 4b9cff73751..4cd69bc8017 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -278,8 +278,7 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
OS << formatv(" [{0}]", Form);
DWARFUnit *U = Die.getDwarfUnit();
- DWARFFormValue FormValue = DWARFFormValue::createFromData(
- Form, U->getFormParams(), *U, U->getDebugInfoExtractor(), OffsetPtr);
+ DWARFFormValue FormValue = DWARFFormValue::createFromUnit(Form, U, OffsetPtr);
OS << "\t(";
@@ -687,9 +686,8 @@ void DWARFDie::attribute_iterator::updateForIndex(
uint32_t ParseOffset = AttrValue.Offset;
auto U = Die.getDwarfUnit();
assert(U && "Die must have valid DWARF unit");
- AttrValue.Value = DWARFFormValue::createFromData(
- AbbrDecl.getFormByIndex(Index), U->getFormParams(), *U,
- U->getDebugInfoExtractor(), &ParseOffset);
+ AttrValue.Value = DWARFFormValue::createFromUnit(
+ AbbrDecl.getFormByIndex(Index), U, &ParseOffset);
AttrValue.ByteSize = ParseOffset - AttrValue.Offset;
} else {
assert(Index == NumAttrs && "Indexes should be [0, NumAttrs) only");
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
index 0d96614ccae..7ddc8820fc6 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
@@ -97,14 +97,11 @@ DWARFFormValue DWARFFormValue::createFromBlockValue(dwarf::Form F,
return DWARFFormValue(F, V);
}
-DWARFFormValue DWARFFormValue::createFromData(dwarf::Form F,
- dwarf::FormParams FormParams,
- const DWARFUnit &U,
- const DWARFDataExtractor &Data,
- uint32_t *OffsetPtr,
- const DWARFContext *Ctx) {
+DWARFFormValue DWARFFormValue::createFromUnit(dwarf::Form F, const DWARFUnit *U,
+ uint32_t *OffsetPtr) {
DWARFFormValue FormValue(F);
- FormValue.extractValue(Data, OffsetPtr, FormParams, &U, Ctx);
+ FormValue.extractValue(U->getDebugInfoExtractor(), OffsetPtr,
+ U->getFormParams(), U);
return FormValue;
}
@@ -234,8 +231,8 @@ bool DWARFFormValue::isFormClass(DWARFFormValue::FormClass FC) const {
bool DWARFFormValue::extractValue(const DWARFDataExtractor &Data,
uint32_t *OffsetPtr, dwarf::FormParams FP,
- const DWARFUnit *CU,
- const DWARFContext *Ctx) {
+ const DWARFContext *Ctx,
+ const DWARFUnit *CU) {
if (!Ctx && CU)
Ctx = &CU->getContext();
C = Ctx;
OpenPOWER on IntegriCloud