[LLVMdev] [Fwd: Re: Check the location of the definition of a Value object]

douglas at dcc.ufmg.br douglas at dcc.ufmg.br
Thu Apr 8 09:43:09 PDT 2010


> I tried:
> ---------------------
> //Value* pb corresponding to %2
> for (BasicBlock::iterator I=entry->begin(), e=entry.end(); I != e; I++)
> {
>        if (I == pb)
>           return true;
> }
> return false;
> ----------------------
>
> However, I got  errors when compiled the code. Could anyone give some
> simple examples about this issue?
>

The method explained by John is more elegant. But if you want to use your
code above, you may do so:

//Value* pb corresponding to %2
 for (BasicBlock::iterator I=entry->begin(), e=entry.end(); I != e; I++)
 {
        if (*I == pb)
           return true;
 }
 return false;
 ----------------------

Best,

Douglas






More information about the llvm-dev mailing list