@@ -1901,13 +1901,17 @@ struct DIEDataWriter : public DataWriter {
1901
1901
// / is described by some DIEAbbrevRef block.
1902
1902
struct DistinctDataWriter : public DataWriter {
1903
1903
Expected<DIEDistinctDataRef> getCASNode (MCCASBuilder &CASBuilder) {
1904
+ #if LLVM_ENABLE_ZLIB
1904
1905
SmallVector<uint8_t > CompressedBuff;
1905
1906
compression::zlib::compress (arrayRefFromStringRef (toStringRef (Data)),
1906
1907
CompressedBuff);
1907
1908
// Reserve 8 bytes for ULEB to store the size of the uncompressed data.
1908
1909
CompressedBuff.append (8 , 0 );
1909
1910
encodeULEB128 (Data.size (), CompressedBuff.end () - 8 , 8 /* Pad to*/ );
1910
1911
return DIEDistinctDataRef::create (CASBuilder, toStringRef (CompressedBuff));
1912
+ #else
1913
+ return DIEDistinctDataRef::create (CASBuilder, toStringRef (Data));
1914
+ #endif
1911
1915
}
1912
1916
};
1913
1917
@@ -3404,16 +3408,19 @@ Error mccasformats::v1::visitDebugInfo(
3404
3408
return LoadedTopRef.takeError ();
3405
3409
3406
3410
StringRef DistinctData = LoadedTopRef->DistinctData .getData ();
3411
+ #if LLVM_ENABLE_ZLIB
3407
3412
ArrayRef<uint8_t > BuffRef = arrayRefFromStringRef (DistinctData);
3408
3413
auto UncompressedSize = decodeULEB128 (BuffRef.data () + BuffRef.size () - 8 );
3409
3414
BuffRef = BuffRef.drop_back (8 );
3410
3415
SmallVector<uint8_t > OutBuff;
3411
3416
if (auto E =
3412
3417
compression::zlib::decompress (BuffRef, OutBuff, UncompressedSize))
3413
3418
return E;
3414
- auto UncompressedDistinctData = toStringRef (OutBuff);
3415
- BinaryStreamReader DistinctReader (UncompressedDistinctData,
3416
- endianness::little);
3419
+ DistinctData = toStringRef (OutBuff);
3420
+ BinaryStreamReader DistinctReader (DistinctData, endianness::little);
3421
+ #else
3422
+ BinaryStreamReader DistinctReader (DistinctData, endianness::little);
3423
+ #endif
3417
3424
ArrayRef<char > HeaderData;
3418
3425
3419
3426
auto BeginOffset = DistinctReader.getOffset ();
@@ -3435,15 +3442,9 @@ Error mccasformats::v1::visitDebugInfo(
3435
3442
HeaderCallback (toStringRef (HeaderData));
3436
3443
3437
3444
append_range (TotAbbrevEntries, LoadedTopRef->AbbrevEntries );
3438
- DIEVisitor Visitor{DwarfVersion,
3439
- {},
3440
- TotAbbrevEntries,
3441
- DistinctReader,
3442
- UncompressedDistinctData,
3443
- HeaderCallback,
3444
- StartTagCallback,
3445
- AttrCallback,
3446
- EndTagCallback,
3445
+ DIEVisitor Visitor{DwarfVersion, {}, TotAbbrevEntries,
3446
+ DistinctReader, DistinctData, HeaderCallback,
3447
+ StartTagCallback, AttrCallback, EndTagCallback,
3447
3448
NewBlockCallback};
3448
3449
return Visitor.visitDIERef (LoadedTopRef->RootDIE );
3449
3450
}
0 commit comments