[LLVMdev] How to convert an iterator to an object pointer
Cameron Zwarich
zwarich at apple.com
Sun Jan 30 20:35:46 PST 2011
On 2011-01-30, at 8:04 PM, Surinder wrote:
> I have a pointer to a basic block and am iterating thru its
> predecessor blocks. I want to get a pointer to the predecessor block.
> How do I do it. I am using following code and it given compile time
> errors.
>
> error: cannot convert 'llvm::const_pred_iterator' to 'const
> llvm::BasicBlock*' in initialization
>
> const BasicBlock *b = PH->getParent();
> // process all pred block of the current block
> for (const_pred_iterator pr=pred_begin(b), esc=pred_end(b); pr!=esc; ++pr)
> { const BasicBlock *p = pr; // ************error line ****************
Try using *pr instead.
Cameron
More information about the llvm-dev
mailing list