diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h index 643dee98f0e28..ab1bc6356dcb9 100644 --- a/llvm/include/llvm/ADT/DenseMap.h +++ b/llvm/include/llvm/ADT/DenseMap.h @@ -257,13 +257,12 @@ class DenseMapBase : public DebugEpochBase { std::pair try_emplace(KeyT &&Key, Ts &&...Args) { BucketT *TheBucket; if (LookupBucketFor(Key, TheBucket)) - return std::make_pair(makeInsertIterator(TheBucket), - false); // Already in map. + return {makeInsertIterator(TheBucket), false}; // Already in map. // Otherwise, insert the new element. TheBucket = InsertIntoBucket(TheBucket, std::move(Key), std::forward(Args)...); - return std::make_pair(makeInsertIterator(TheBucket), true); + return {makeInsertIterator(TheBucket), true}; } // Inserts key,value pair into the map if the key isn't already in the map. @@ -273,12 +272,11 @@ class DenseMapBase : public DebugEpochBase { std::pair try_emplace(const KeyT &Key, Ts &&...Args) { BucketT *TheBucket; if (LookupBucketFor(Key, TheBucket)) - return std::make_pair(makeInsertIterator(TheBucket), - false); // Already in map. + return {makeInsertIterator(TheBucket), false}; // Already in map. // Otherwise, insert the new element. TheBucket = InsertIntoBucket(TheBucket, Key, std::forward(Args)...); - return std::make_pair(makeInsertIterator(TheBucket), true); + return {makeInsertIterator(TheBucket), true}; } /// Alternate version of insert() which allows a different, and possibly @@ -291,13 +289,12 @@ class DenseMapBase : public DebugEpochBase { const LookupKeyT &Val) { BucketT *TheBucket; if (LookupBucketFor(Val, TheBucket)) - return std::make_pair(makeInsertIterator(TheBucket), - false); // Already in map. + return {makeInsertIterator(TheBucket), false}; // Already in map. // Otherwise, insert the new element. TheBucket = InsertIntoBucketWithLookup(TheBucket, std::move(KV.first), std::move(KV.second), Val); - return std::make_pair(makeInsertIterator(TheBucket), true); + return {makeInsertIterator(TheBucket), true}; } /// insert - Range insertion of pairs. diff --git a/llvm/include/llvm/ADT/MapVector.h b/llvm/include/llvm/ADT/MapVector.h index 015605fd98dff..24976535716d1 100644 --- a/llvm/include/llvm/ADT/MapVector.h +++ b/llvm/include/llvm/ADT/MapVector.h @@ -123,9 +123,9 @@ class MapVector { It->second = Vector.size(); Vector.emplace_back(std::piecewise_construct, std::forward_as_tuple(Key), std::forward_as_tuple(std::forward(Args)...)); - return std::make_pair(std::prev(end()), true); + return {std::prev(end()), true}; } - return std::make_pair(begin() + It->second, false); + return {begin() + It->second, false}; } template std::pair try_emplace(KeyT &&Key, Ts &&...Args) { @@ -135,9 +135,9 @@ class MapVector { Vector.emplace_back(std::piecewise_construct, std::forward_as_tuple(std::move(Key)), std::forward_as_tuple(std::forward(Args)...)); - return std::make_pair(std::prev(end()), true); + return {std::prev(end()), true}; } - return std::make_pair(begin() + It->second, false); + return {begin() + It->second, false}; } std::pair insert(const std::pair &KV) { diff --git a/llvm/include/llvm/ADT/SmallPtrSet.h b/llvm/include/llvm/ADT/SmallPtrSet.h index f55627c6866f7..16ad3973e054d 100644 --- a/llvm/include/llvm/ADT/SmallPtrSet.h +++ b/llvm/include/llvm/ADT/SmallPtrSet.h @@ -172,14 +172,14 @@ class SmallPtrSetImplBase : public DebugEpochBase { // Check to see if it is already in the set. for (const void *&Bucket : small_buckets()) { if (Bucket == Ptr) - return std::make_pair(&Bucket, false); + return {&Bucket, false}; } // Nope, there isn't. If we stay small, just 'pushback' now. if (NumEntries < CurArraySize) { CurArray[NumEntries++] = Ptr; incrementEpoch(); - return std::make_pair(CurArray + (NumEntries - 1), true); + return {CurArray + (NumEntries - 1), true}; } // Otherwise, hit the big set case, which will call grow. } @@ -400,7 +400,7 @@ class SmallPtrSetImpl : public SmallPtrSetImplBase { /// the element equal to Ptr. std::pair insert(PtrType Ptr) { auto p = insert_imp(PtrTraits::getAsVoidPointer(Ptr)); - return std::make_pair(makeIterator(p.first), p.second); + return {makeIterator(p.first), p.second}; } /// Insert the given pointer with an iterator hint that is ignored. This is diff --git a/llvm/include/llvm/ADT/SparseSet.h b/llvm/include/llvm/ADT/SparseSet.h index d9ded9875d377..a8ebc9f786486 100644 --- a/llvm/include/llvm/ADT/SparseSet.h +++ b/llvm/include/llvm/ADT/SparseSet.h @@ -258,10 +258,10 @@ class SparseSet { unsigned Idx = ValIndexOf(Val); iterator I = findIndex(Idx); if (I != end()) - return std::make_pair(I, false); + return {I, false}; Sparse[Idx] = size(); Dense.push_back(Val); - return std::make_pair(end() - 1, true); + return {end() - 1, true}; } /// array subscript - If an element already exists with this key, return it. diff --git a/llvm/include/llvm/ADT/StringMap.h b/llvm/include/llvm/ADT/StringMap.h index 0bf062f988f3a..dbc0485967ac6 100644 --- a/llvm/include/llvm/ADT/StringMap.h +++ b/llvm/include/llvm/ADT/StringMap.h @@ -380,8 +380,8 @@ class LLVM_ALLOCATORHOLDER_EMPTYBASE StringMap unsigned BucketNo = LookupBucketFor(Key, FullHashValue); StringMapEntryBase *&Bucket = TheTable[BucketNo]; if (Bucket && Bucket != getTombstoneVal()) - return std::make_pair(iterator(TheTable + BucketNo, false), - false); // Already exists in map. + return {iterator(TheTable + BucketNo, false), + false}; // Already exists in map. if (Bucket == getTombstoneVal()) --NumTombstones; @@ -391,7 +391,7 @@ class LLVM_ALLOCATORHOLDER_EMPTYBASE StringMap assert(NumItems + NumTombstones <= NumBuckets); BucketNo = RehashTable(BucketNo); - return std::make_pair(iterator(TheTable + BucketNo, false), true); + return {iterator(TheTable + BucketNo, false), true}; } // clear - Empties out the StringMap