[LLVMdev] dynamic_cast error

Chris Lattner sabre at nondot.org
Tue Feb 14 09:44:57 PST 2006


On Tue, 14 Feb 2006, Pratik Mehta wrote:
> Following statement from LLVM Programmer's Manual is not compiling.
> CallInst* callInst = dyn_cast<CallInst>(&*basic_block_iterator_1);
>
> callsite.cc:22:   instantiated from here
>
> llvm/include/llvm/Support/Casting.h:52: error: incomplete type
> 'llvm::CallInst' used in nested name specifier
>
> Any hints about what the issue could be?

You need to include llvm/Instructions.h to get the definition of CallInst.

FWIW, this:

  CallInst* callInst = dyn_cast<CallInst>(&*basic_block_iterator_1);

is equivalent to this:

   CallInst* callInst = dyn_cast<CallInst>(basic_block_iterator_1);

if basic_block_iterator_1 is a BasicBlock::iterator.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/




More information about the llvm-dev mailing list