On Tue, Jul 26, 2011 at 10:59 PM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com">clattner@apple.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div style="word-wrap:break-word"><div class="im"><br><div><div>On Jul 26, 2011, at 9:17 PM, Talin wrote:</div><br><blockquote type="cite"><span style="border-collapse:separate;font-family:Helvetica;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium">Here's an example of how this would be used: In the constructor for ConstantVector, there's an assert:<div>

<br><div><div><div><font face="'courier new', monospace">  assert(C->getType() == T->getElementType() &&</font></div><div><font face="'courier new', monospace">         "Initializer for vector element doesn't match vector element type!");</font></div>

</div><div><br></div><div>I would change this to:</div><br><div><div><font face="'courier new', monospace">  ASSERT_STRM(C->getType() == T->getElementType(),</font></div><div><font face="'courier new', monospace">    "Initializer for vector element " << I - V.begin() << " with type " <<</font></div>

<div><font face="'courier new', monospace">    C->getType() << " doesn't match vector element type " <<</font></div><div><font face="'courier new', monospace">    T->getElementType());</font></div>

<div><br></div></div><div>With more detailed assertions like this, a much larger class of programmer errors can be diagnosed without having to go into the debugger.</div><div><br></div><div>Because the stream is a raw_ostream, LLVM types and values can easily be printed to the stream without having to convert them to string form.</div>

</div></div></span></blockquote><br></div></div><div>I'm unconvinced that this is worth it at all.  This is only going to allow you to "avoid going into the debugger" in the most trivial cases.</div><div><br>

</div></div></blockquote><div>From an API user's perspective, those trivial cases happen quite frequently, at least in my experience. Often times I only need to know what type is involved to figure out what went wrong.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div></div><font color="#888888"><div>-Chris</div></font></div></blockquote>

</div><br><br clear="all"><br>-- <br>-- Talin<br>