[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-dev
Subject:    Re: [LLVMdev] #uses
From:       Chris Lattner <sabre () nondot ! org>
Date:       2002-09-17 18:15:01
Message-ID: Pine.LNX.4.30.0209171816500.13108-100000 () nondot ! org
[Download RAW message or body]

> Hi, Chris, can you tell me why it should be
> dyn_cast<Instruction>(*i) instead of
> dyn_cast<Instruction>(&*i)? I remember when do the iteration
> on the basic block. We use code like this:
>
> for(BasicBlock::iterator i = b->begin(); ie = b->end(); i !=
> ie; ++i) {
>                     if (CallInst* callInst =
> dyn_cast<CallInst>(&*i)) {
>
> Can you tell me why they are different?

BasicBlock::iterator and Value::use_iterator are different types.
Dereferencing a BasicBlock::iterator returns a reference to an
instruction, dereferencing a Value::use_iterator returns a pointer to the
use.

-Chris

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic