NVPTX: remove raw delete call

Also make members that are never accessed outside the class
private.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216363 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dylan Noblesmith 2014-08-25 01:59:29 +00:00
parent 1e321bba6e
commit 0280c4c7a7

View File

@ -86,13 +86,13 @@ class LLVM_LIBRARY_VISIBILITY NVPTXAsmPrinter : public AsmPrinter {
// Once we have this AggBuffer setup, we can choose how to print // Once we have this AggBuffer setup, we can choose how to print
// it out. // it out.
public: public:
unsigned size; // size of the buffer in bytes
unsigned char *buffer; // the buffer
unsigned numSymbols; // number of symbol addresses unsigned numSymbols; // number of symbol addresses
SmallVector<unsigned, 4> symbolPosInBuffer;
SmallVector<const Value *, 4> Symbols;
private: private:
const unsigned size; // size of the buffer in bytes
std::vector<unsigned char> buffer; // the buffer
SmallVector<unsigned, 4> symbolPosInBuffer;
SmallVector<const Value *, 4> Symbols;
unsigned curpos; unsigned curpos;
raw_ostream &O; raw_ostream &O;
NVPTXAsmPrinter &AP; NVPTXAsmPrinter &AP;
@ -100,14 +100,11 @@ class LLVM_LIBRARY_VISIBILITY NVPTXAsmPrinter : public AsmPrinter {
public: public:
AggBuffer(unsigned _size, raw_ostream &_O, NVPTXAsmPrinter &_AP) AggBuffer(unsigned _size, raw_ostream &_O, NVPTXAsmPrinter &_AP)
: O(_O), AP(_AP) { : size(_size), buffer(_size), O(_O), AP(_AP) {
buffer = new unsigned char[_size];
size = _size;
curpos = 0; curpos = 0;
numSymbols = 0; numSymbols = 0;
EmitGeneric = AP.EmitGeneric; EmitGeneric = AP.EmitGeneric;
} }
~AggBuffer() { delete[] buffer; }
unsigned addBytes(unsigned char *Ptr, int Num, int Bytes) { unsigned addBytes(unsigned char *Ptr, int Num, int Bytes) {
assert((curpos + Num) <= size); assert((curpos + Num) <= size);
assert((curpos + Bytes) <= size); assert((curpos + Bytes) <= size);
@ -179,9 +176,9 @@ class LLVM_LIBRARY_VISIBILITY NVPTXAsmPrinter : public AsmPrinter {
else else
nextSymbolPos = symbolPosInBuffer[nSym]; nextSymbolPos = symbolPosInBuffer[nSym];
} else if (nBytes == 4) } else if (nBytes == 4)
O << *(unsigned int *)(buffer + pos); O << *(unsigned int *)(&buffer[pos]);
else else
O << *(unsigned long long *)(buffer + pos); O << *(unsigned long long *)(&buffer[pos]);
} }
} }
} }