[PATCH] D34600: [Error] add expectSuccess()

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 29 17:15:54 PDT 2017


chandlerc added a comment.

In https://reviews.llvm.org/D34600#796166, @lhames wrote:

> cantFail always felt like a quirky name though - what about 'assertSuccess'?
>
> > This seems like a textbook assert use case to me. No different than assert(foo != nullptr);
>
> Yep. The only reason to use cantFail/expectSuccess is if you *know* the callee can't return an error via this callsite. If you're wrong about that it's a programmatic error like any other.


Sorry, total agreement. I was only aiming for one that wasn't even behind NDEBUG as it seems pointless to "optimize" this code path rather than crashing quickly. But no big deal anyways. I think the interesting thing is finding a good name. I'll let you two figure this out, i"ve given my meager ideas.


https://reviews.llvm.org/D34600





More information about the llvm-commits mailing list