Implement and use new method Function::hasAddressTaken().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73164 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jay Foad
2009-06-10 08:41:11 +00:00
parent cb597c9cc4
commit 757068f3ba
5 changed files with 21 additions and 38 deletions
+11
View File
@@ -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