[LLVMdev] returning from function

Chris Lattner sabre at nondot.org
Fri Nov 22 16:08:01 PST 2002

On Fri, 22 Nov 2002, Juan Nicolas Ruiz wrote:

> It is valid that a function returns without using an Instruction::Ret
> as the last instruction?

No: http://llvm.cs.uiuc.edu/docs/LangRef.html#terminators

All basic blocks must have a terminator.

> If so, can we assume that a BasicBlock with
> no successors is an exit BB?

Yes, but you don't want to do this.  Just do:
if (isa<ReturnInst>(BB->getTerminator()))
  and be done with it, that's much more explicit.



More information about the llvm-dev mailing list