<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Improve legibility by formatting addresses with printv"
   href="https://bugs.llvm.org/show_bug.cgi?id=36632">36632</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Improve legibility by formatting addresses with printv
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>DebugInfo
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jdevlieghere@apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>