3

I am trying to get the users of alloca instruction (to basically get the users of a variable). I am using the following code to do so:

virtual bool runOnModule(Module &M)
{
        for(Module::iterator F= M.begin(), E = M.end(); F != E; ++F) // iterating over functions in a module
        {
            for (Function::iterator FI = F->begin(), E = F->end(); FI != E; ++FI)    // iterating over BB in a function
            {
                for (BasicBlock::iterator I = FI->begin(), E = FI->end(); I != E; ++I) // iterating over instructions in the BB
                {
                    Value* v = cast<Value>(I);
                    v->user_begin ();
                }
            }
        }
        return false;
    }

However, it's giving me the error:

error: ‘class llvm::Value’ has no member named ‘user_begin’

Can anyone tell me why this is happening and suggest a possible solution to what I'm trying to do here (get users of a variable)?

mikasa
  • 783
  • 1
  • 11
  • 29

1 Answers1

0

I think you can directly use user_begin without casting Instruction to Value. Just like:

I->user_begin()
David Buck
  • 3,752
  • 35
  • 31
  • 35
10ca1h0st
  • 21
  • 4