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, 22 insertions, 21 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
index f4dd7993760..f607dfe37cb 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
@@ -166,10 +166,8 @@ Optional<DWARFFormValue> DWARFAbbreviationDeclaration::getAttributeValue(
if (Spec.isImplicitConst())
return DWARFFormValue::createFromSValue(Spec.Form,
Spec.getImplicitConstValue());
-
- DWARFFormValue FormValue(Spec.Form);
- if (FormValue.extractValue(DebugInfoData, &Offset, U.getFormParams(), &U))
- return FormValue;
+ return DWARFFormValue::createFromData(Spec.Form, U.getFormParams(), U,
+ U.getDebugInfoExtractor(), &Offset);
}
// 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 a2c25248618..8dbca510d15 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -212,15 +212,14 @@ parseV5DirFileTables(const DWARFDataExtractor &DebugLineData,
if (*OffsetPtr >= EndPrologueOffset)
return false;
for (auto Descriptor : DirDescriptors) {
- DWARFFormValue Value(Descriptor.Form);
switch (Descriptor.Type) {
case DW_LNCT_path:
- if (!Value.extractValue(DebugLineData, OffsetPtr, FormParams, &Ctx, U))
- return false;
- IncludeDirectories.push_back(Value);
+ IncludeDirectories.push_back(DWARFFormValue::createFromData(
+ Descriptor.Form, FormParams, *U, DebugLineData, OffsetPtr, &Ctx));
break;
default:
- if (!Value.skipValue(DebugLineData, OffsetPtr, FormParams))
+ if (!DWARFFormValue::skipValue(Descriptor.Form, DebugLineData,
+ OffsetPtr, FormParams))
return false;
}
}
@@ -240,9 +239,8 @@ parseV5DirFileTables(const DWARFDataExtractor &DebugLineData,
return false;
DWARFDebugLine::FileNameEntry FileEntry;
for (auto Descriptor : FileDescriptors) {
- DWARFFormValue Value(Descriptor.Form);
- if (!Value.extractValue(DebugLineData, OffsetPtr, FormParams, &Ctx, U))
- return false;
+ DWARFFormValue Value = DWARFFormValue::createFromData(
+ Descriptor.Form, FormParams, *U, DebugLineData, OffsetPtr, &Ctx);
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 4cd69bc8017..4b9cff73751 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -278,7 +278,8 @@ static void dumpAttribute(raw_ostream &OS, const DWARFDie &Die,
OS << formatv(" [{0}]", Form);
DWARFUnit *U = Die.getDwarfUnit();
- DWARFFormValue FormValue = DWARFFormValue::createFromUnit(Form, U, OffsetPtr);
+ DWARFFormValue FormValue = DWARFFormValue::createFromData(
+ Form, U->getFormParams(), *U, U->getDebugInfoExtractor(), OffsetPtr);
OS << "\t(";
@@ -686,8 +687,9 @@ 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::createFromUnit(
- AbbrDecl.getFormByIndex(Index), U, &ParseOffset);
+ AttrValue.Value = DWARFFormValue::createFromData(
+ AbbrDecl.getFormByIndex(Index), U->getFormParams(), *U,
+ U->getDebugInfoExtractor(), &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 7ddc8820fc6..0d96614ccae 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
@@ -97,11 +97,14 @@ DWARFFormValue DWARFFormValue::createFromBlockValue(dwarf::Form F,
return DWARFFormValue(F, V);
}
-DWARFFormValue DWARFFormValue::createFromUnit(dwarf::Form F, const DWARFUnit *U,
- uint32_t *OffsetPtr) {
+DWARFFormValue DWARFFormValue::createFromData(dwarf::Form F,
+ dwarf::FormParams FormParams,
+ const DWARFUnit &U,
+ const DWARFDataExtractor &Data,
+ uint32_t *OffsetPtr,
+ const DWARFContext *Ctx) {
DWARFFormValue FormValue(F);
- FormValue.extractValue(U->getDebugInfoExtractor(), OffsetPtr,
- U->getFormParams(), U);
+ FormValue.extractValue(Data, OffsetPtr, FormParams, &U, Ctx);
return FormValue;
}
@@ -231,8 +234,8 @@ bool DWARFFormValue::isFormClass(DWARFFormValue::FormClass FC) const {
bool DWARFFormValue::extractValue(const DWARFDataExtractor &Data,
uint32_t *OffsetPtr, dwarf::FormParams FP,
- const DWARFContext *Ctx,
- const DWARFUnit *CU) {
+ const DWARFUnit *CU,
+ const DWARFContext *Ctx) {
if (!Ctx && CU)
Ctx = &CU->getContext();
C = Ctx;
OpenPOWER on IntegriCloud