[lld] r258499 - Use of llvm_unreachable instead of warning in EhFrameHeader<ELFT>::assignEhFrame().
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 22 10:16:32 PST 2016
>I think we're talking past each other a bit, and I'm not quite sure how to resolve the disconnect here, but I'll try.
>
>The general idea is that code shouldn't be written to be resilient to programmer errors - once invariants and preconditions have been violated, there's really nothing we can do >anyway. Also, we don't want to spend time checking all these invariants and preconditions in release builds (because we want the compiler to be fast). So we use assertions and >unreachable, rather than conditionals and error handling/reporting for cases that are not intended to be possible. ( http://llvm.org/docs/CodingStandards.html#assert-liberally>discusses some of this)
>
>In short, if this case is only reachable by a programmer error, it should be an assert. (unreachable is used when it's a block of code that can't be reached - like a default in a switch, >the end of a function that has some algorithmic reason to always return through some other path, etc - this is discussed in the coding standard linked above)
?Ok, I will change it to assert. Thanks for your time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160122/ab90f16e/attachment.html>
More information about the llvm-commits
mailing list