reformulate CallSite::getCallee to adapt to CallInst::ArgOffset, and make it work even if CallInst::op_* are private

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107390 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Gabor Greif 2010-07-01 10:41:37 +00:00
parent c6f00e701e
commit fa680ea1eb

View File

@ -33,7 +33,9 @@ using namespace llvm;
User::op_iterator CallSite::getCallee() const {
Instruction *II(getInstruction());
return isCall()
? cast<CallInst>(II)->op_begin()
? (CallInst::ArgOffset
? cast</*FIXME: CallInst*/User>(II)->op_begin()
: cast</*FIXME: CallInst*/User>(II)->op_end() - 1)
: cast<InvokeInst>(II)->op_end() - 3; // Skip BB, BB, Function
}