aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Function.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2009-06-10 08:41:11 +0000
committerJay Foad <jay.foad@gmail.com>2009-06-10 08:41:11 +0000
commit757068f3bad425fb126fe16ab7b8a82a636e6bbd (patch)
tree16aac7d61fc8b5409af46cc2b5cc3245e3fd9ad3 /lib/VMCore/Function.cpp
parentcb597c9cc457ee0bb9c6ab3195b90da6d0049caf (diff)
Implement and use new method Function::hasAddressTaken().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73164 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Function.cpp')
-rw-r--r--lib/VMCore/Function.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index 3a991f62d8..54bd895fd4 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -364,4 +364,15 @@ Function *Intrinsic::getDeclaration(Module *M, ID id, const Type **Tys,
#include "llvm/Intrinsics.gen"
#undef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
+ /// hasAddressTaken - returns true if there are any uses of this function
+ /// other than direct calls or invokes to it.
+bool Function::hasAddressTaken() const {
+ for (Value::use_const_iterator I = use_begin(), E = use_end(); I != E; ++I) {
+ if (I.getOperandNo() != 0 ||
+ (!isa<CallInst>(*I) && !isa<InvokeInst>(*I)))
+ return true;
+ }
+ return false;
+}
+
// vim: sw=2 ai