<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - Make the debug info hierarchy strict"
   href="http://llvm.org/bugs/show_bug.cgi?id=22777">22777</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Make the debug info hierarchy strict
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Core LLVM classes
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>dexonsmith@apple.com
          </td>
        </tr>

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

        <tr>
          <th>CC</th>
          <td>aprantl@apple.com, dblaikie@gmail.com, echristo@gmail.com, friss@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>21432
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>After introducing specialized metadata nodes in <a class="bz_bug_link 
          bz_status_ASSIGNED "
   title="ASSIGNED --- - Debug Info IR: Add specialized nodes for DIDescriptor hierarchy"
   href="show_bug.cgi?id=22464">bug 22464</a>, we can take
advantage of having a real type hierarchy.  There's a lot of looseness in the
debug info IR.  I'll use this bug to track fixing it.

Here's a rough guide of what I think needs doing:

1. Turn on the debug info verifier by default.  This will require cleaning up
some testcase bitrot; I might also have to work through some real bugs that
have crept in.  (You may wonder, why was this turned off in the first place? 
It's way too expensive as a function pass, since many functions transitively
reference the entire type hierarchy.  But r206300 changed it to a module pass
so the overhead should be reasonable (and worth it).)

2. Check types everywhere:
(a) Add type checks to the verifier.  For example, verify that `!dbg` points at
`MDLocation`s and that `MDLocation::getInlinedAt()` returns an `MDLocation`. 
(There are a ton of things like this.)
(b) Change DIDescriptor accessors to `cast<>` or `cast_or_null<>`.
(c) Change the specialized nodes to `cast<>` and `cast_or_null<>` their operand
accessors.

3. Empty out the DIDescriptor wrappers.
(a) Override `operator->()` and `operator*()` for subclasses to point at the
specialized nodes.
(b) Remove wrapping accessors, forcing null checks in the users.

After that, it'll be pretty natural to remove the `DIDescriptor` wrappers
entirely (and use the specialized nodes directly).</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>