[LLVMdev] Iterating over all uses of a Function

Mikhail Glushenkov foldr at codedgers.com
Tue Apr 21 04:33:41 PDT 2009


Hi,

I try to iterate over all uses of a Function with the following
code (simplified):

for (Value::use_iterator UI = F->use_begin(), UE = F->use_end();
                         UI != UE; ++UI) {

    if (CallInst* I = dyn_cast<CallInst>(*UI)) {
    // do something interesting
    }
}
 
This works on Linux, but on Windows the dyn_cast fails, even
though the only use of F in that module is a 'call'. However,
dyn_cast<Instruction>(*UI) works, and returns a pointer
to "<Invalid operator>" instruction.

Is this a bug or am I doing something incorrectly?





More information about the llvm-dev mailing list