mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
Switch from new[] + delete[] to malloc + free since llvm does not catch C++ exceptions.
llvm-svn: 64448
This commit is contained in:
parent
643730a194
commit
ec9d3c889f
@ -38,7 +38,7 @@ using namespace llvm;
|
||||
|
||||
MemoryBuffer::~MemoryBuffer() {
|
||||
if (MustDeleteBuffer)
|
||||
delete [] BufferStart;
|
||||
free((void*)BufferStart);
|
||||
}
|
||||
|
||||
/// initCopyOf - Initialize this source buffer with a copy of the specified
|
||||
@ -46,7 +46,7 @@ MemoryBuffer::~MemoryBuffer() {
|
||||
/// successfully.
|
||||
void MemoryBuffer::initCopyOf(const char *BufStart, const char *BufEnd) {
|
||||
size_t Size = BufEnd-BufStart;
|
||||
BufferStart = new char[Size+1];
|
||||
BufferStart = (char *)malloc((Size+1) * sizeof(char));
|
||||
BufferEnd = BufferStart+Size;
|
||||
memcpy(const_cast<char*>(BufferStart), BufStart, Size);
|
||||
*const_cast<char*>(BufferEnd) = 0; // Null terminate buffer.
|
||||
@ -108,7 +108,7 @@ MemoryBuffer *MemoryBuffer::getMemBufferCopy(const char *StartPtr,
|
||||
/// the MemoryBuffer object.
|
||||
MemoryBuffer *MemoryBuffer::getNewUninitMemBuffer(size_t Size,
|
||||
const char *BufferName) {
|
||||
char *Buf = new char[Size+1];
|
||||
char *Buf = (char *)malloc((Size+1) * sizeof(char));
|
||||
if (!Buf) return 0;
|
||||
Buf[Size] = 0;
|
||||
MemoryBufferMem *SB = new MemoryBufferMem(Buf, Buf+Size, BufferName);
|
||||
|
Loading…
Reference in New Issue
Block a user