reformulate CallSite::getCallee to adapt to CallInst::ArgOffset, and make it work...
authorGabor Greif <ggreif@gmail.com>
Thu, 1 Jul 2010 10:41:37 +0000 (10:41 +0000)
committerGabor Greif <ggreif@gmail.com>
Thu, 1 Jul 2010 10:41:37 +0000 (10:41 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107390 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/Instructions.cpp

index e8ac392d71fb50599073c28dc7fdcaee858ec0da..a06365921808930026f6150b385fd98c170e88e8 100644 (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
 }