aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-31 18:38:06 +0000
committerChris Lattner <sabre@nondot.org>2003-10-31 18:38:06 +0000
commitbc539434c5ab3b537336cc2a6212d0f24d8f791d (patch)
tree4db401c2df30a066081ef6f7fd4e314a156dcd96 /lib
parent94082397d28b172830ba5f449b9dab301e47e5b7 (diff)
Did I mention that I _HATE_ CPRs?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9639 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/iCall.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/VMCore/iCall.cpp b/lib/VMCore/iCall.cpp
index fcaa1e1930..b99c9e7bb3 100644
--- a/lib/VMCore/iCall.cpp
+++ b/lib/VMCore/iCall.cpp
@@ -143,3 +143,15 @@ Function *InvokeInst::getCalledFunction() {
return cast<Function>(CPR->getValue());
return 0;
}
+
+#include "llvm/Support/CallSite.h"
+
+Function *CallSite::getCalledFunction() const {
+ Value *Callee = getCalledValue();
+ if (Function *F = dyn_cast<Function>(Callee))
+ return F;
+ if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Callee))
+ return cast<Function>(CPR->getValue());
+ return 0;
+}
+