<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 14, 2015 at 2:39 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
> On 2015-Jan-14, at 14:35, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
><br>
> Modified: llvm/trunk/include/llvm/IR/DebugInfo.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=226048&r1=226047&r2=226048&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=226048&r1=226047&r2=226048&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/include/llvm/IR/DebugInfo.h (original)<br>
> +++ llvm/trunk/include/llvm/IR/DebugInfo.h Wed Jan 14 16:27:36 2015<br>
> @@ -877,10 +877,26 @@ class DILocation : public DIDescriptor {<br>
> public:<br>
> explicit DILocation(const MDNode *N) : DIDescriptor(N) {}<br>
><br>
> - unsigned getLineNumber() const { return getUnsignedField(0); }<br>
> - unsigned getColumnNumber() const { return getUnsignedField(1); }<br>
> - DIScope getScope() const { return getFieldAs<DIScope>(2); }<br>
> - DILocation getOrigLocation() const { return getFieldAs<DILocation>(3); }<br>
> + unsigned getLineNumber() const {<br>
> + if (auto *L = dyn_cast_or_null<MDLocation>(DbgNode))<br>
><br>
> What else can this be other than an MDLocation? Should it just be cast_or_null?<br>
<br>
</span>*I* think it should be. I'd actually go further and make this<br>
`cast<MDLocation>` (if `DbgNode` is `nullptr`, this shouldn't be<br>
called at all), but that's obviously a major semantic change.<br>
<br>
However, the `DIDescriptor` stuff is very permissive right now<br>
about what's going on underneath. It never asserts, it just returns<br>
things like `0` and `nullptr`. `dyn_cast_or_null<>` kept this<br>
initial commit NFC.</blockquote><div><br>I've been pretty aggressive about making things less vague/permissive as I've been making progress, adding assertions for things being of certain types, etc (subprograms in the subprogram list only, etc).<br><br>Welcome to do the same, though I realize it's not necessarily your fight to fight right now.<br><br>- David<br> </div></div><br></div></div>