@@ -62,7 +62,7 @@ Error extractOffloadBundle(MemoryBufferRef Contents, uint64_t SectionOffset,
6262 return createFileError (FileName, EC);
6363
6464 Expected<std::unique_ptr<MemoryBuffer>> DecompressedBufferOrErr =
65- CompressedOffloadBundle::decompress (**CodeOrErr, false );
65+ CompressedOffloadBundle::decompress (**CodeOrErr, false , errs () );
6666 if (!DecompressedBufferOrErr)
6767 return createStringError (
6868 inconvertibleErrorCode (),
@@ -297,7 +297,7 @@ static std::string formatWithCommas(unsigned long long Value) {
297297Expected<std::unique_ptr<MemoryBuffer>>
298298CompressedOffloadBundle::compress (compression::Params P,
299299 const MemoryBuffer &Input, uint16_t Version,
300- bool Verbose) {
300+ bool Verbose, raw_ostream &OutS ) {
301301 if (!compression::zstd::isAvailable () && !compression::zlib::isAvailable ())
302302 return createStringError (" compression not supported." );
303303 Timer HashTimer (" Hash Calculation Timer" , " Hash calculation time" ,
@@ -385,7 +385,7 @@ CompressedOffloadBundle::compress(compression::Params P,
385385 double CompressionTimeSeconds = CompressTimer.getTotalTime ().getWallTime ();
386386 double CompressionSpeedMBs =
387387 (UncompressedSize64 / (1024.0 * 1024.0 )) / CompressionTimeSeconds;
388- errs () << " Compressed bundle format version: " << Version << " \n "
388+ OutS << " Compressed bundle format version: " << Version << " \n "
389389 << " Total file size (including headers): "
390390 << formatWithCommas (TotalFileSize64) << " bytes\n "
391391 << " Compression method used: " << MethodUsed << " \n "
@@ -510,7 +510,7 @@ CompressedOffloadBundle::CompressedBundleHeader::tryParse(StringRef Blob) {
510510}
511511
512512Expected<std::unique_ptr<MemoryBuffer>>
513- CompressedOffloadBundle::decompress (const MemoryBuffer &Input, bool Verbose) {
513+ CompressedOffloadBundle::decompress (const MemoryBuffer &Input, bool Verbose, raw_ostream &OS ) {
514514 StringRef Blob = Input.getBuffer ();
515515
516516 // Check minimum header size (using V1 as it's the smallest).
@@ -519,7 +519,7 @@ CompressedOffloadBundle::decompress(const MemoryBuffer &Input, bool Verbose) {
519519
520520 if (identify_magic (Blob) != file_magic::offload_bundle_compressed) {
521521 if (Verbose)
522- errs () << " Uncompressed bundle\n " ;
522+ OS << " Uncompressed bundle\n " ;
523523 return MemoryBuffer::getMemBufferCopy (Blob);
524524 }
525525
@@ -577,11 +577,11 @@ CompressedOffloadBundle::decompress(const MemoryBuffer &Input, bool Verbose) {
577577 double DecompressionSpeedMBs =
578578 (UncompressedSize / (1024.0 * 1024.0 )) / DecompressionTimeSeconds;
579579
580- errs () << " Compressed bundle format version: " << ThisVersion << " \n " ;
580+ OS << " Compressed bundle format version: " << ThisVersion << " \n " ;
581581 if (ThisVersion >= 2 )
582- errs () << " Total file size (from header): "
582+ OS << " Total file size (from header): "
583583 << formatWithCommas (TotalFileSize) << " bytes\n " ;
584- errs () << " Decompression method: "
584+ OS << " Decompression method: "
585585 << (CompressionFormat == compression::Format::Zlib ? " zlib" : " zstd" )
586586 << " \n "
587587 << " Size before decompression: "
0 commit comments