[cfe-commits] Switching assert(0/false to llvm_unreachable

David Blaikie dblaikie at gmail.com
Mon Oct 17 23:08:06 PDT 2011


On Wed, Sep 21, 2011 at 12:58 PM, David Blaikie <dblaikie at gmail.com> wrote:

> As per recent discussions on cfe-commits, here's a patch to change all
> sure-failing assertions to llvm_unreachables (this task was made easier by
> the canonicalization of these asserts that Richard's been doing with the new
> boolean conversion from string warning - which meant there were only two
> major cases ("assert(0 &&" and "assert(false &&" - I don't think I found any
> message-less asserts in clang though I think there are some in LLVM
> itself)). The only other thing I had to do was some 80 col wraps due to the
> increase in length.
>
> If this is the right thing just say the word & I'll check it in.
>

(bump)

Yes/no/maybe? (this'll probably need an update to catch new cases - but I
figured I'd check to see if this is preferred before I do that. Perhaps
either way we can add something to the documentation to describe when to use
each of these devices (assert(false && "foo") or llvm_unreachable("foo")).
The same goes for my "default case" patch that I just bumped too - either
way, I'll try to document the convention for future reference)

- David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111017/addf3c2f/attachment.html>


More information about the cfe-commits mailing list