[LLVMdev] Verifier & abort()

Chris Lattner sabre at nondot.org
Thu Apr 1 21:21:02 PST 2004


On Thu, 1 Apr 2004, Reid Spencer wrote:

> On Thu, 2004-04-01 at 18:04, Misha Brukman wrote:
>
> > Perhaps another solution would be to throw an exception with the error
> > message?
>
> Perhaps, but that would violate the programming contract already in
> place. Right now LLVM and its users expect failed verifications to cause
> an abort(). I wouldn't want to unleash on LLVM the new semantics of now
> handling exceptions in every place the verifier is called especially
> since the exception is basically saying "corrupt Module, use at your own
> risk".  Additionally, exceptions can only throw single strings from
> single places but the verifier can actually generate multiple lines of
> output (from multiple checks) before deciding to abort.

The verifier should provide two APIs:

1. The Verifier pass should do what it currently does: check the program
   and abort on failure.
2. There should be a VerifyModule function which checks the program and
   throws an exception on error with an error message.  I would assume
   that this is the one you would want to use.

I don't think that the verifier can actually emit multiple error messages.
After it finds one problem, it can't really depend on the state of the
module, so it bails out immediately.  Throwing the exception would give
the same semantics and allow the caller code to decide how to handle it...

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/




More information about the llvm-dev mailing list