Bug ID: 36632
           Summary: Improve legibility by formatting addresses with printv
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: DebugInfo

When printing addresses in libDebugInfo, we currently use the format function.
While this is alright when just printing addresses, it's quite annoying when
part of an error message, as the formatting is intertwined with the message

For example, in the DWARF verifier we see something like this:

error() << FormEncodingString(Form) << " CU offset " << format("0x%08" PRIx64,
CUOffset) << " is invalid (must be less than CU size of " << format("0x%08"
PRIx32, CUSize) << "):\n";

Compare this to the alternative below which uses formatv. This is clearly much
more legible. 

error() << FormEncodingString(Form) << formatv("CU offset {0:x} is invalid
(must be less than CU size of  {1:x}ā€):\nā€, CUOffset, CUSize)

If the types for CUOffset and CUSize are correct, we don't even have to specify
their length. However this is something that should be thoroughly tested, as
the size of the addresses is almost always significant. 

We should go through the uses of format in libDebugInfo (in particular the
DWARF verifier) and see where we can improve the legibility of the code by
using formatv.

You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to