[LLVMdev] Verifier & abort()

Chris Lattner sabre at nondot.org
Fri Apr 2 00:30:03 PST 2004


On Thu, 1 Apr 2004, Reid Spencer wrote:

> P.S. Here's an example of verifier code that can emit multiple messages:
>
>  bool doFinalization(Module &M) {
>       // Scan through, checking all of the external function's linkage now...
>       for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
>         visitGlobalValue(*I);
>
>       for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
>         visitGlobalValue(*I);
>
>       // If the module is broken, abort at this time.
>       abortIfBroken();
>       return false;
>     }
>
> The function visitGlobalValue will check one value, print out a message
> and set Broken=true. The abort doesn't happen until abortIfBroken() is
> called.

Ah, ok I see.  Still I don't know if that's really behavior that you need
to go out of your way to preserve.  Usually if the module is broken, it's
best to just find that out and escape quickly!  :)

-Chris

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




More information about the llvm-dev mailing list