[LLVMdev] LLVM asserts

Chris Lattner clattner at apple.com
Wed Aug 19 09:29:51 PDT 2009


On Aug 19, 2009, at 9:02 AM, Kenneth Uildriks wrote:

> How do you get LLVM methods to return or throw an error to the
> caller's code rather than aborting the process?  I'd like my compiler
> to be able to print diagnostic messages, including language source
> lines, whenever LLVM reports a problem.

Hi Kenneth,

Recoverable errors are handled with llvm/Support/ErrorHandling.h.  We  
use asserts for conditions that "cannot happen".  These are internal  
errors and are not recoverable.  The best way to not get one of these  
is for your compiler to not have bugs :)

-Chris



More information about the llvm-dev mailing list