Use new DWARFDataExtractor::getInitialLength in DWARFVerifier
authorPavel Labath <pavel@labath.sk>
Tue, 3 Mar 2020 17:57:18 +0000 (18:57 +0100)
committerPavel Labath <pavel@labath.sk>
Wed, 4 Mar 2020 12:01:34 +0000 (13:01 +0100)
llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp

index 68bacbf..c96dceb 100644 (file)
@@ -112,11 +112,9 @@ bool DWARFVerifier::verifyUnitHeader(const DWARFDataExtractor DebugInfoData,
   bool ValidAbbrevOffset = true;
 
   uint64_t OffsetStart = *Offset;
-  Length = DebugInfoData.getU32(Offset);
-  if (Length == dwarf::DW_LENGTH_DWARF64) {
-    Length = DebugInfoData.getU64(Offset);
-    isUnitDWARF64 = true;
-  }
+  DwarfFormat Format;
+  std::tie(Length, Format) = DebugInfoData.getInitialLength(Offset);
+  isUnitDWARF64 = Format == DWARF64;
   Version = DebugInfoData.getU16(Offset);
 
   if (Version >= 5) {