Index: include/llvm/ADT/SmallVector.h =================================================================== --- include/llvm/ADT/SmallVector.h +++ include/llvm/ADT/SmallVector.h @@ -365,16 +365,6 @@ } public: - ~SmallVectorImpl() { - // Destroy the constructed elements in the vector. - this->destroy_range(this->begin(), this->end()); - - // If this wasn't grown from the inline copy, deallocate the old space. - if (!this->isSmall()) - free(this->begin()); - } - - void clear() { this->destroy_range(this->begin(), this->end()); this->EndX = this->BeginX; @@ -926,9 +916,19 @@ this->assign(IL); return *this; } + + ~SmallVector() { + if (this->isSmall()) { + // Destroy the constructed elements in the vector. + this->destroy_range(this->begin(), this->end()); + } else { + // If this wasn't grown from the inline copy, deallocate the old space. + free(this->begin()); + } + } }; -template +template static inline size_t capacity_in_bytes(const SmallVector &X) { return X.capacity_in_bytes(); }