[LLVMdev] Aborting a pass

Trevor Harmon Trevor.W.Harmon at nasa.gov
Thu Mar 11 12:49:14 PST 2010


On Mar 1, 2010, at 11:04 AM, Trevor Harmon wrote:

> What's the proper way to abort a pass if something goes wrong (e.g.,
> in the pass's constructor)? Do I simply call abort()?

Calling abort() causes a stack dump to the console, which is good for  
serious errors, but overkill for most other types of error situations,  
such as a command-line parameter that the user forgot to add. For  
these situations, I'm printing an informative error message to errs()  
and then calling exit(-1). I'm not sure if that's the best approach,  
but it seems to coax the expected behavior out of LLVM.

Trevor




More information about the llvm-dev mailing list