Fix handling of 'free' if it has absolutely no prototype

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7721 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2003-08-11 15:05:08 +00:00
parent 4c08840e4b
commit 1f28e8ce4d

View File

@ -93,6 +93,13 @@ bool RaiseAllocations::doInitialization(Module &M) {
FreeFunc = M.getFunction("free", FreeType);
}
// One last try, check to see if we can find free as 'int (...)* free'. This
// handles the case where NOTHING was declared.
if (FreeFunc == 0) {
FreeType = FunctionType::get(Type::IntTy, std::vector<const Type*>(),true);
FreeFunc = M.getFunction("free", FreeType);
}
// Don't mess with locally defined versions of these functions...
if (MallocFunc && !MallocFunc->isExternal()) MallocFunc = 0;