Changes in directory llvm/include/llvm/ADT:
SmallVector.h updated: 1.2 -> 1.3 --- Log message: The smallvector dtor should destroy the elements. Implement pop_back. Chage some code to use 'iterator' instead of T*. This unbreaks operators=. --- Diffs of the changes: (+12 -2) SmallVector.h | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) Index: llvm/include/llvm/ADT/SmallVector.h diff -u llvm/include/llvm/ADT/SmallVector.h:1.2 llvm/include/llvm/ADT/SmallVector.h:1.3 --- llvm/include/llvm/ADT/SmallVector.h:1.2 Wed Jul 26 22:38:08 2006 +++ llvm/include/llvm/ADT/SmallVector.h Fri Jul 28 00:03:42 2006 @@ -66,6 +66,10 @@ std::uninitialized_copy(RHS.begin(), RHS.end(), Begin); } ~SmallVector() { + // Destroy the constructed elements in the vector. + for (iterator I = Begin, E = End; I != E; ++I) + I->~T(); + // If this wasn't grown from the inline copy, deallocate the old space. if ((void*)Begin != (void*)InlineElts) delete[] (char*)Begin; @@ -115,6 +119,12 @@ goto Retry; } + void pop_back() { + assert(!empty() && "SmallVector is empty!"); + --End; + End->~T(); + } + /// append - Add the specified range to the end of the SmallVector. /// template<typename in_iter> @@ -154,7 +164,7 @@ // This allows us to avoid copying them during the grow. if (Capacity-Begin < RHSSize) { // Destroy current elements. - for (T *I = Begin, E = End; I != E; ++I) + for (iterator I = Begin, E = End; I != E; ++I) I->~T(); End = Begin; CurSize = 0; @@ -192,7 +202,7 @@ std::uninitialized_copy(Begin, End, NewElts); // Destroy the original elements. - for (T *I = Begin, *E = End; I != E; ++I) + for (iterator I = Begin, E = End; I != E; ++I) I->~T(); // If this wasn't grown from the inline copy, deallocate the old space. _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits