LLVM's use_iterator example
LLVM 3.5 Instruction::use_iterator for (Instruction::use_iterator ui = instruction->use_begin(), ue = instruction->use_end(); ui != ue; ++ui) { #if defined LLVM_3_2 || defined LLVM_3_3 || defined LLVM_3_4 llvm::Instruction *user = cast<Instruction>(*ui); #else llvm::Instruction *user = cast<Instruction> (ui->getUser()); #endif Value *v = pending.back(); for (Value::use_iterator i = v->use_begin(), e = v->use_end(); != e; ++i) { } llvm::Function *F = M.getFunction(BARRIER_FUNCTION_NAME); if (F != NULL) { for (llvm::Function::use_iterator i = F->use_begin(), e = F->use_end(); i != e; ++i) B.push_back(llvm::cast<Barrier>(*i)); }