From 483ffa33656cc7045bb620e5ccbcfd072eb55d00 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Sun, 15 Jan 2017 01:11:47 +0000 Subject: [PATCH] Simplify string output. NFC. llvm-svn: 292042 --- lld/COFF/MapFile.cpp | 8 ++------ lld/ELF/MapFile.cpp | 6 ++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lld/COFF/MapFile.cpp b/lld/COFF/MapFile.cpp index 81365827c3f1..00e4788f872d 100644 --- a/lld/COFF/MapFile.cpp +++ b/lld/COFF/MapFile.cpp @@ -36,9 +36,7 @@ using namespace lld::coff; static void writeOutSecLine(raw_fd_ostream &OS, uint64_t Address, uint64_t Size, uint64_t Align, StringRef Name) { - OS << format_hex_no_prefix(Address, 8) << ' ' - << format_hex_no_prefix(Size, 8) << ' ' << format("%5x ", Align) - << left_justify(Name, 7); + OS << format("%08x %08x %5x ", Address, Size, Align) << left_justify(Name, 7); } static void writeInSecLine(raw_fd_ostream &OS, uint64_t Address, uint64_t Size, @@ -89,9 +87,7 @@ static void writeSectionChunk(raw_fd_ostream &OS, const SectionChunk *SC, static void writeMapFile2(raw_fd_ostream &OS, ArrayRef OutputSections) { - OS << left_justify("Address", 8) << ' ' << left_justify("Size", 8) - << ' ' << left_justify("Align", 5) << ' ' << left_justify("Out", 7) << ' ' - << left_justify("In", 7) << ' ' << left_justify("File", 7) << " Symbol\n"; + OS << "Address Size Align Out In File Symbol\n"; for (OutputSection *Sec : OutputSections) { uint32_t VA = Sec->getRVA(); diff --git a/lld/ELF/MapFile.cpp b/lld/ELF/MapFile.cpp index 648baa9d2412..9f7a6f391845 100644 --- a/lld/ELF/MapFile.cpp +++ b/lld/ELF/MapFile.cpp @@ -35,8 +35,7 @@ using namespace lld::elf; static void writeOutSecLine(raw_fd_ostream &OS, int Width, uint64_t Address, uint64_t Size, uint64_t Align, StringRef Name) { - OS << format_hex_no_prefix(Address, Width) << ' ' - << format_hex_no_prefix(Size, Width) << ' ' << format("%5x ", Align) + OS << format("%0*x %0*x %5x ", Width, Address, Width, Size, Align) << left_justify(Name, 7); } @@ -100,8 +99,7 @@ static void writeMapFile2(raw_fd_ostream &OS, int Width = ELFT::Is64Bits ? 16 : 8; OS << left_justify("Address", Width) << ' ' << left_justify("Size", Width) - << ' ' << left_justify("Align", 5) << ' ' << left_justify("Out", 7) << ' ' - << left_justify("In", 7) << ' ' << left_justify("File", 7) << " Symbol\n"; + << " Align Out In File Symbol\n"; for (OutputSectionBase *Sec : OutputSections) { writeOutSecLine(OS, Width, Sec->Addr, Sec->Size, Sec->Addralign,