Now that we have the ReturnsTwice function attribute, this method is

obsolete. Check the attribute instead.
<rdar://problem/8031714>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142212 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling
2011-10-17 18:22:52 +00:00
parent f1fddcd9e0
commit 728662f9e8
5 changed files with 7 additions and 52 deletions

View File

@@ -411,44 +411,4 @@ bool Function::hasAddressTaken(const User* *PutOffender) const {
return false;
}
/// callsFunctionThatReturnsTwice - Return true if the function has a call to
/// setjmp or other function that gcc recognizes as "returning twice".
///
/// FIXME: Remove after <rdar://problem/8031714> is fixed.
/// FIXME: Is the above FIXME valid?
bool Function::callsFunctionThatReturnsTwice() const {
static const char *const ReturnsTwiceFns[] = {
"_setjmp",
"setjmp",
"sigsetjmp",
"setjmp_syscall",
"savectx",
"qsetjmp",
"vfork",
"getcontext"
};
for (const_inst_iterator I = inst_begin(this), E = inst_end(this); I != E;
++I) {
const CallInst* callInst = dyn_cast<CallInst>(&*I);
if (!callInst)
continue;
if (callInst->canReturnTwice())
return true;
// check for known function names.
// FIXME: move this to clang.
Function *F = callInst->getCalledFunction();
if (!F)
continue;
StringRef Name = F->getName();
for (unsigned J = 0, e = array_lengthof(ReturnsTwiceFns); J != e; ++J) {
if (Name == ReturnsTwiceFns[J])
return true;
}
}
return false;
}
// vim: sw=2 ai