1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

The proper prototype for malloc returns a pointer, not an unsized array

llvm-svn: 1463
This commit is contained in:
Chris Lattner 2001-12-14 16:32:20 +00:00
parent 831b4ac558
commit 315df5b058

View File

@ -24,7 +24,6 @@
#include "llvm/iOther.h" #include "llvm/iOther.h"
#include <algorithm> #include <algorithm>
static const Type *PtrArrSByte = 0; // '[sbyte]*' type
static const Type *PtrSByte = 0; // 'sbyte*' type static const Type *PtrSByte = 0; // 'sbyte*' type
// ConvertCallTo - Convert a call to a varargs function with no arg types // ConvertCallTo - Convert a call to a varargs function with no arg types
@ -226,10 +225,8 @@ bool CleanupGCCOutput::doPassInitialization(Module *M) {
FUT.doPassInitialization(M); FUT.doPassInitialization(M);
if (PtrArrSByte == 0) { if (PtrSByte == 0)
PtrArrSByte = PointerType::get(ArrayType::get(Type::SByteTy)); PtrSByte = PointerType::get(Type::SByteTy);
PtrSByte = PointerType::get(Type::SByteTy);
}
if (M->hasSymbolTable()) { if (M->hasSymbolTable()) {
SymbolTable *ST = M->getSymbolTable(); SymbolTable *ST = M->getSymbolTable();
@ -304,7 +301,7 @@ bool CleanupGCCOutput::doOneCleanupPass(Method *M) {
if (CallInst *CI = dyn_cast<CallInst>(I)) { if (CallInst *CI = dyn_cast<CallInst>(I)) {
if (CI->getCalledValue() == Malloc) { // Replace call to malloc? if (CI->getCalledValue() == Malloc) { // Replace call to malloc?
MallocInst *MallocI = new MallocInst(PtrArrSByte, CI->getOperand(1), MallocInst *MallocI = new MallocInst(PtrSByte, CI->getOperand(1),
CI->getName()); CI->getName());
CI->setName(""); CI->setName("");
BI = BIL.insert(BI, MallocI)+1; BI = BIL.insert(BI, MallocI)+1;