@@ -214,7 +214,7 @@ static void printDarwinSectionSizes(MachOObjectFile *MachO) {
214
214
if (Load.C .cmd == MachO::LC_SEGMENT_64) {
215
215
MachO::segment_command_64 Seg = MachO->getSegment64LoadCommand (Load);
216
216
outs () << " Segment " << Seg.segname << " : "
217
- << format (fmt. str () .c_str (), Seg.vmsize );
217
+ << format (fmtbuf .c_str (), Seg.vmsize );
218
218
if (DarwinLongFormat)
219
219
outs () << " (vmaddr 0x" << format (" %" PRIx64, Seg.vmaddr ) << " fileoff "
220
220
<< Seg.fileoff << " )" ;
@@ -228,20 +228,20 @@ static void printDarwinSectionSizes(MachOObjectFile *MachO) {
228
228
<< format (" %.16s" , &Sec.sectname ) << " ): " ;
229
229
else
230
230
outs () << " \t Section " << format (" %.16s" , &Sec.sectname ) << " : " ;
231
- outs () << format (fmt. str () .c_str (), Sec.size );
231
+ outs () << format (fmtbuf .c_str (), Sec.size );
232
232
if (DarwinLongFormat)
233
233
outs () << " (addr 0x" << format (" %" PRIx64, Sec.addr ) << " offset "
234
234
<< Sec.offset << " )" ;
235
235
outs () << " \n " ;
236
236
sec_total += Sec.size ;
237
237
}
238
238
if (Seg.nsects != 0 )
239
- outs () << " \t total " << format (fmt. str () .c_str (), sec_total) << " \n " ;
239
+ outs () << " \t total " << format (fmtbuf .c_str (), sec_total) << " \n " ;
240
240
} else if (Load.C .cmd == MachO::LC_SEGMENT) {
241
241
MachO::segment_command Seg = MachO->getSegmentLoadCommand (Load);
242
242
uint64_t Seg_vmsize = Seg.vmsize ;
243
243
outs () << " Segment " << Seg.segname << " : "
244
- << format (fmt. str () .c_str (), Seg_vmsize);
244
+ << format (fmtbuf .c_str (), Seg_vmsize);
245
245
if (DarwinLongFormat)
246
246
outs () << " (vmaddr 0x" << format (" %" PRIx32, Seg.vmaddr ) << " fileoff "
247
247
<< Seg.fileoff << " )" ;
@@ -256,18 +256,18 @@ static void printDarwinSectionSizes(MachOObjectFile *MachO) {
256
256
else
257
257
outs () << " \t Section " << format (" %.16s" , &Sec.sectname ) << " : " ;
258
258
uint64_t Sec_size = Sec.size ;
259
- outs () << format (fmt. str () .c_str (), Sec_size);
259
+ outs () << format (fmtbuf .c_str (), Sec_size);
260
260
if (DarwinLongFormat)
261
261
outs () << " (addr 0x" << format (" %" PRIx32, Sec.addr ) << " offset "
262
262
<< Sec.offset << " )" ;
263
263
outs () << " \n " ;
264
264
sec_total += Sec.size ;
265
265
}
266
266
if (Seg.nsects != 0 )
267
- outs () << " \t total " << format (fmt. str () .c_str (), sec_total) << " \n " ;
267
+ outs () << " \t total " << format (fmtbuf .c_str (), sec_total) << " \n " ;
268
268
}
269
269
}
270
- outs () << " total " << format (fmt. str () .c_str (), total) << " \n " ;
270
+ outs () << " total " << format (fmtbuf .c_str (), total) << " \n " ;
271
271
}
272
272
273
273
// / Print the summary sizes of the standard Mach-O segments in @p MachO.
@@ -399,7 +399,7 @@ static void printObjectSectionSizes(ObjectFile *Obj) {
399
399
<< " %" << max_addr_len << " s\n " ;
400
400
401
401
// Print header
402
- outs () << format (fmt. str () .c_str (), static_cast <const char *>(" section" ),
402
+ outs () << format (fmtbuf .c_str (), static_cast <const char *>(" section" ),
403
403
static_cast <const char *>(" size" ),
404
404
static_cast <const char *>(" addr" ));
405
405
fmtbuf.clear ();
@@ -422,13 +422,13 @@ static void printObjectSectionSizes(ObjectFile *Obj) {
422
422
423
423
uint64_t size = Section.getSize ();
424
424
uint64_t addr = Section.getAddress ();
425
- outs () << format (fmt. str () .c_str (), name_or_err->str ().c_str (), size, addr);
425
+ outs () << format (fmtbuf .c_str (), name_or_err->str ().c_str (), size, addr);
426
426
}
427
427
428
428
if (ELFCommons) {
429
429
if (Expected<uint64_t > CommonSizeOrErr = getCommonSize (Obj)) {
430
430
total += *CommonSizeOrErr;
431
- outs () << format (fmt. str () .c_str (), std::string (" *COM*" ).c_str (),
431
+ outs () << format (fmtbuf .c_str (), std::string (" *COM*" ).c_str (),
432
432
*CommonSizeOrErr, static_cast <uint64_t >(0 ));
433
433
} else {
434
434
error (CommonSizeOrErr.takeError (), Obj->getFileName ());
@@ -440,8 +440,7 @@ static void printObjectSectionSizes(ObjectFile *Obj) {
440
440
fmtbuf.clear ();
441
441
fmt << " %-" << max_name_len << " s "
442
442
<< " %#" << max_size_len << radix_fmt << " \n " ;
443
- outs () << format (fmt.str ().c_str (), static_cast <const char *>(" Total" ),
444
- total)
443
+ outs () << format (fmtbuf.c_str (), static_cast <const char *>(" Total" ), total)
445
444
<< " \n\n " ;
446
445
} else {
447
446
// The Berkeley format does not display individual section sizes. It
@@ -498,11 +497,11 @@ static void printObjectSectionSizes(ObjectFile *Obj) {
498
497
fmt << " %#7" << radix_fmt << " \t "
499
498
<< " %#7" << radix_fmt << " \t "
500
499
<< " %#7" << radix_fmt << " \t " ;
501
- outs () << format (fmt. str () .c_str (), total_text, total_data, total_bss);
500
+ outs () << format (fmtbuf .c_str (), total_text, total_data, total_bss);
502
501
fmtbuf.clear ();
503
502
fmt << " %7" << (Radix == octal ? PRIo64 : PRIu64) << " \t "
504
503
<< " %7" PRIx64 " \t " ;
505
- outs () << format (fmt. str () .c_str (), total, total);
504
+ outs () << format (fmtbuf .c_str (), total, total);
506
505
}
507
506
}
508
507
@@ -852,12 +851,12 @@ static void printBerkeleyTotals() {
852
851
fmt << " %#7" << radix_fmt << " \t "
853
852
<< " %#7" << radix_fmt << " \t "
854
853
<< " %#7" << radix_fmt << " \t " ;
855
- outs () << format (fmt. str () .c_str (), TotalObjectText, TotalObjectData,
854
+ outs () << format (fmtbuf .c_str (), TotalObjectText, TotalObjectData,
856
855
TotalObjectBss);
857
856
fmtbuf.clear ();
858
857
fmt << " %7" << (Radix == octal ? PRIo64 : PRIu64) << " \t "
859
858
<< " %7" PRIx64 " \t " ;
860
- outs () << format (fmt. str () .c_str (), TotalObjectTotal, TotalObjectTotal)
859
+ outs () << format (fmtbuf .c_str (), TotalObjectTotal, TotalObjectTotal)
861
860
<< " (TOTALS)\n " ;
862
861
}
863
862
0 commit comments