Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions llvm/include/llvm/ADT/DenseMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,12 @@ class DenseMapBase : public DebugEpochBase {
std::pair<iterator, bool> 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<Ts>(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.
Expand All @@ -273,12 +272,11 @@ class DenseMapBase : public DebugEpochBase {
std::pair<iterator, bool> 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<Ts>(Args)...);
return std::make_pair(makeInsertIterator(TheBucket), true);
return {makeInsertIterator(TheBucket), true};
}

/// Alternate version of insert() which allows a different, and possibly
Expand All @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions llvm/include/llvm/ADT/MapVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Ts>(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 <typename... Ts>
std::pair<iterator, bool> try_emplace(KeyT &&Key, Ts &&...Args) {
Expand All @@ -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<Ts>(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<iterator, bool> insert(const std::pair<KeyT, ValueT> &KV) {
Expand Down
6 changes: 3 additions & 3 deletions llvm/include/llvm/ADT/SmallPtrSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
Expand Down Expand Up @@ -400,7 +400,7 @@ class SmallPtrSetImpl : public SmallPtrSetImplBase {
/// the element equal to Ptr.
std::pair<iterator, bool> 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
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/ADT/SparseSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions llvm/include/llvm/ADT/StringMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
Loading