1313#include " llvm/DebugInfo/DWARF/DWARFDie.h"
1414#include " llvm/DebugInfo/DWARF/DWARFFormValue.h"
1515#include " llvm/Support/Errc.h"
16+ #include " llvm/Support/FormatAdapters.h"
17+ #include " llvm/Support/FormatVariadic.h"
1618#include " llvm/Support/WithColor.h"
1719#include " llvm/Support/raw_ostream.h"
1820#include < cstdint>
@@ -30,19 +32,20 @@ uint8_t DWARFDebugMacro::MacroHeader::getOffsetByteSize() const {
3032
3133void DWARFDebugMacro::MacroHeader::dumpMacroHeader (raw_ostream &OS) const {
3234 // FIXME: Add support for dumping opcode_operands_table
33- OS << format (" macro header: version = 0x%04 " PRIx16 , Version)
34- << format (" , flags = 0x%02 " PRIx8 , Flags)
35+ OS << formatv (" macro header: version = {0:x4} " , Version)
36+ << formatv (" , flags = {0:x2} " , Flags)
3537 << " , format = " << FormatString (getDwarfFormat ());
3638 if (Flags & MACRO_DEBUG_LINE_OFFSET)
37- OS << format (" , debug_line_offset = 0x%0*" PRIx64, 2 * getOffsetByteSize (),
38- DebugLineOffset);
39+ OS << formatv (" , debug_line_offset = 0x{0:x-}" ,
40+ fmt_align (DebugLineOffset, AlignStyle::Right,
41+ 2 * getOffsetByteSize (), ' 0' ));
3942 OS << " \n " ;
4043}
4144
4245void DWARFDebugMacro::dump (raw_ostream &OS) const {
4346 unsigned IndLevel = 0 ;
4447 for (const auto &Macros : MacroLists) {
45- OS << format ( " 0x%08 " PRIx64 " :\n " , Macros.Offset );
48+ OS << formatv ( " {0:x8} :\n " , Macros.Offset );
4649 if (Macros.IsDebugMacro )
4750 Macros.Header .dumpMacroHeader (OS);
4851 for (const Entry &E : Macros.Macros ) {
@@ -89,8 +92,9 @@ void DWARFDebugMacro::dump(raw_ostream &OS) const {
8992 OS << " filenum: " << E.File ;
9093 break ;
9194 case DW_MACRO_import:
92- OS << format (" - import offset: 0x%0*" PRIx64,
93- 2 * Macros.Header .getOffsetByteSize (), E.ImportOffset );
95+ OS << formatv (" - import offset: 0x{0:x-}" ,
96+ fmt_align (E.ImportOffset , AlignStyle::Right,
97+ 2 * Macros.Header .getOffsetByteSize (), ' 0' ));
9498 break ;
9599 case DW_MACRO_end_file:
96100 break ;
0 commit comments