[llvm-bugs] [Bug 36632] New: Improve legibility by formatting addresses with printv
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Mar 7 08:45:24 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=36632
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
Assignee: unassignedbugs at nondot.org
Reporter: jdevlieghere at apple.com
CC: llvm-bugs at lists.llvm.org
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
itself.
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180307/047070a6/attachment.html>
More information about the llvm-bugs
mailing list