diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h index 86592f12ce62c..fa87b812f9bf8 100644 --- a/llvm/include/llvm/ADT/DenseMap.h +++ b/llvm/include/llvm/ADT/DenseMap.h @@ -751,18 +751,12 @@ class DenseMap : public DenseMapBase, init(NumElementsToReserve); } - DenseMap(const DenseMap &other) : BaseT() { - init(0); - this->copyFrom(other); - } + DenseMap(const DenseMap &other) : DenseMap() { this->copyFrom(other); } - DenseMap(DenseMap &&other) : BaseT() { - init(0); - this->swap(other); - } + DenseMap(DenseMap &&other) : DenseMap() { this->swap(other); } - template DenseMap(const InputIt &I, const InputIt &E) { - init(std::distance(I, E)); + template + DenseMap(const InputIt &I, const InputIt &E) : DenseMap(std::distance(I, E)) { this->insert(I, E); } @@ -901,19 +895,15 @@ class SmallDenseMap init(NumElementsToReserve); } - SmallDenseMap(const SmallDenseMap &other) : BaseT() { - init(0); + SmallDenseMap(const SmallDenseMap &other) : SmallDenseMap() { this->copyFrom(other); } - SmallDenseMap(SmallDenseMap &&other) : BaseT() { - init(0); - this->swap(other); - } + SmallDenseMap(SmallDenseMap &&other) : SmallDenseMap() { this->swap(other); } template - SmallDenseMap(const InputIt &I, const InputIt &E) { - init(std::distance(I, E)); + SmallDenseMap(const InputIt &I, const InputIt &E) + : SmallDenseMap(std::distance(I, E)) { this->insert(I, E); }