summaryrefslogtreecommitdiff
path: root/lib/Bytecode
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-24 17:20:52 +0000
committerChris Lattner <sabre@nondot.org>2007-04-24 17:20:52 +0000
commit4ab2d2009e4a16d1a5104047e1e2cdbbf2cb9b1a (patch)
treeded3c3ddeb21c902a4cf269a228dc757b91a74ed /lib/Bytecode
parent253bb78adb5121988f98fc57e944248eae8cf2ea (diff)
fix a memory leak
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36396 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode')
-rw-r--r--lib/Bytecode/Reader/Analyzer.cpp18
-rw-r--r--lib/Bytecode/Reader/Reader.cpp11
2 files changed, 15 insertions, 14 deletions
diff --git a/lib/Bytecode/Reader/Analyzer.cpp b/lib/Bytecode/Reader/Analyzer.cpp
index 2a752d769cc..dde73dfb1a8 100644
--- a/lib/Bytecode/Reader/Analyzer.cpp
+++ b/lib/Bytecode/Reader/Analyzer.cpp
@@ -165,7 +165,7 @@ public:
<< " Linkage=" << Linkage
<< " Visibility="<< Visibility
<< " Type=";
- WriteTypeSymbolic(*os, ElemType, M);
+ //WriteTypeSymbolic(*os, ElemType, M);
*os << " Slot=" << SlotNum << " InitSlot=" << initSlot
<< "\n";
}
@@ -187,7 +187,7 @@ public:
bca.numTypes++;
if (os) {
*os << " Type: ";
- WriteTypeSymbolic(*os,Ty,M);
+ //WriteTypeSymbolic(*os,Ty,M);
*os << "\n";
}
}
@@ -199,7 +199,7 @@ public:
bca.numValues++;
if (os) {
*os << " Function Decl: ";
- WriteTypeSymbolic(*os,Func->getType(),M);
+ //WriteTypeSymbolic(*os,Func->getType(),M);
*os <<", Linkage=" << Func->getLinkage();
*os <<", Visibility=" << Func->getVisibility();
*os << "\n";
@@ -276,13 +276,13 @@ public:
<< " Linkage: " << Func->getLinkage() << "\n"
<< " Visibility: " << Func->getVisibility() << "\n"
<< " Type: ";
- WriteTypeSymbolic(*os,Func->getType(),M);
+ //WriteTypeSymbolic(*os,Func->getType(),M);
*os << "\n";
}
currFunc = &bca.FunctionInfo[Func];
std::ostringstream tmp;
- WriteTypeSymbolic(tmp,Func->getType(),M);
+ //WriteTypeSymbolic(tmp,Func->getType(),M);
currFunc->description = tmp.str();
currFunc->name = Func->getName();
currFunc->byteSize = Size;
@@ -388,7 +388,7 @@ public:
Constant* ArrayVal ) {
if (os) {
*os << " ARRAY: ";
- WriteTypeSymbolic(*os,AT,M);
+ //WriteTypeSymbolic(*os,AT,M);
*os << " TypeSlot=" << TypeSlot << "\n";
for (unsigned i = 0; i != NumElts; ++i) {
*os << " #" << i;
@@ -411,7 +411,7 @@ public:
{
if (os) {
*os << " STRUC: ";
- WriteTypeSymbolic(*os,ST,M);
+ //WriteTypeSymbolic(*os,ST,M);
*os << "\n";
for ( unsigned i = 0; i != NumElts; ++i) {
*os << " #" << i << " "; Elements[i]->print(*os);
@@ -433,7 +433,7 @@ public:
{
if (os) {
*os << " PACKD: ";
- WriteTypeSymbolic(*os,PT,M);
+ //WriteTypeSymbolic(*os,PT,M);
*os << " TypeSlot=" << TypeSlot << "\n";
for ( unsigned i = 0; i != NumElts; ++i ) {
*os << " #" << i;
@@ -453,7 +453,7 @@ public:
unsigned Slot, GlobalValue* GV ) {
if (os) {
*os << " PNTR: ";
- WriteTypeSymbolic(*os,PT,M);
+ //WriteTypeSymbolic(*os,PT,M);
*os << " Slot=" << Slot << " GlobalValue=";
GV->print(*os);
*os << "\n";
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp
index 98ed57ea6f4..ee6d9e6208c 100644
--- a/lib/Bytecode/Reader/Reader.cpp
+++ b/lib/Bytecode/Reader/Reader.cpp
@@ -1299,11 +1299,12 @@ Value *BytecodeReader::ParseConstantPoolValue(unsigned TypeID) {
Result = ConstantInt::get(IT, Val);
if (Handler) Handler->handleConstantValue(Result);
} else {
- uint32_t numWords = read_vbr_uint();
- uint64_t *data = new uint64_t[numWords];
- for (uint32_t i = 0; i < numWords; ++i)
- data[i] = read_vbr_uint64();
- Result = ConstantInt::get(APInt(IT->getBitWidth(), numWords, data));
+ uint32_t NumWords = read_vbr_uint();
+ SmallVector<uint64_t, 8> Words;
+ Words.resize(NumWords);
+ for (uint32_t i = 0; i < NumWords; ++i)
+ Words[i] = read_vbr_uint64();
+ Result = ConstantInt::get(APInt(IT->getBitWidth(), NumWords, &Words[0]));
if (Handler) Handler->handleConstantValue(Result);
}
break;