From 1f28e8ce4d8b2c31769e819619a8600349327ba2 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 11 Aug 2003 15:05:08 +0000 Subject: [PATCH] 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 --- lib/Transforms/IPO/RaiseAllocations.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp index 75c2247755c..dcfdb34b91e 100644 --- a/lib/Transforms/IPO/RaiseAllocations.cpp +++ b/lib/Transforms/IPO/RaiseAllocations.cpp @@ -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(),true); + FreeFunc = M.getFunction("free", FreeType); + } + // Don't mess with locally defined versions of these functions... if (MallocFunc && !MallocFunc->isExternal()) MallocFunc = 0;