Changes in directory llvm/lib/Bytecode/Reader:
Analyzer.cpp updated: 1.40 -> 1.41 Reader.cpp updated: 1.253 -> 1.254 --- Log message: fix a memory leak --- Diffs of the changes: (+15 -14) Analyzer.cpp | 18 +++++++++--------- Reader.cpp | 11 ++++++----- 2 files changed, 15 insertions(+), 14 deletions(-) Index: llvm/lib/Bytecode/Reader/Analyzer.cpp diff -u llvm/lib/Bytecode/Reader/Analyzer.cpp:1.40 llvm/lib/Bytecode/Reader/Analyzer.cpp:1.41 --- llvm/lib/Bytecode/Reader/Analyzer.cpp:1.40 Thu Apr 12 13:32:50 2007 +++ llvm/lib/Bytecode/Reader/Analyzer.cpp Tue Apr 24 12:20:52 2007 @@ -165,7 +165,7 @@ << " Linkage=" << Linkage << " Visibility="<< Visibility << " Type="; - WriteTypeSymbolic(*os, ElemType, M); + //WriteTypeSymbolic(*os, ElemType, M); *os << " Slot=" << SlotNum << " InitSlot=" << initSlot << "\n"; } @@ -187,7 +187,7 @@ bca.numTypes++; if (os) { *os << " Type: "; - WriteTypeSymbolic(*os,Ty,M); + //WriteTypeSymbolic(*os,Ty,M); *os << "\n"; } } @@ -199,7 +199,7 @@ 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 @@ << " 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 @@ 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 @@ { 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 @@ { 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 @@ 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"; Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.253 llvm/lib/Bytecode/Reader/Reader.cpp:1.254 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.253 Sun Apr 22 17:22:02 2007 +++ llvm/lib/Bytecode/Reader/Reader.cpp Tue Apr 24 12:20:52 2007 @@ -1299,11 +1299,12 @@ 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; _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits