Revert "[DWARFFormValue] Cleanup DWARFFormValue interface. (2/2) (NFC)"
This reverts commit r355233, it was causing UBSan failures.
llvm-svn: 355255
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index 8dbca51..a2c2524 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -212,14 +212,15 @@
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 @@
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;