Skip to content

Commit e9587c0

Browse files
authored
Merge branch 'users/vhscampos/smallset-simplify' into users/vhscampos/smallset-insert-perfect-forwarding
2 parents a2eb495 + 3d83c54 commit e9587c0

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

clang/lib/Basic/TargetID.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "clang/Basic/TargetID.h"
10+
#include "llvm/ADT/STLExtras.h"
1011
#include "llvm/ADT/SmallSet.h"
1112
#include "llvm/Support/raw_ostream.h"
1213
#include "llvm/TargetParser/TargetParser.h"

llvm/include/llvm/ADT/SmallSet.h

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@
1616

1717
#include "llvm/ADT/SmallPtrSet.h"
1818
#include "llvm/ADT/SmallVector.h"
19-
#include "llvm/ADT/STLExtras.h"
2019
#include "llvm/ADT/iterator.h"
21-
#include "llvm/Support/Compiler.h"
22-
#include "llvm/Support/type_traits.h"
2320
#include <cstddef>
2421
#include <functional>
2522
#include <set>
26-
#include <type_traits>
2723
#include <utility>
2824

2925
namespace llvm {
@@ -180,10 +176,9 @@ class SmallSet {
180176
bool erase(const T &V) {
181177
if (!isSmall())
182178
return Set.erase(V);
183-
184-
auto It = llvm::find(Vector, V);
185-
if (It != Vector.end()) {
186-
Vector.erase(It);
179+
auto I = std::find(Vector.begin(), Vector.end(), V);
180+
if (I != Vector.end()) {
181+
Vector.erase(I);
187182
return true;
188183
}
189184
return false;
@@ -209,8 +204,8 @@ class SmallSet {
209204
/// Check if the SmallSet contains the given element.
210205
bool contains(const T &V) const {
211206
if (isSmall())
212-
return llvm::is_contained(Vector, V);
213-
return llvm::is_contained(Set, V);
207+
return std::find(Vector.begin(), Vector.end(), V) != Vector.end();
208+
return Set.find(V) != Set.end();
214209
}
215210

216211
private:
@@ -225,8 +220,8 @@ class SmallSet {
225220
return {const_iterator(I), Inserted};
226221
}
227222

228-
if (auto I = llvm::find(Vector, V);
229-
I != Vector.end()) // Don't reinsert if it already exists.
223+
auto I = std::find(Vector.begin(), Vector.end(), V);
224+
if (I != Vector.end()) // Don't reinsert if it already exists.
230225
return {const_iterator(I), false};
231226
if (Vector.size() < N) {
232227
Vector.push_back(std::forward<ArgType>(V));

0 commit comments

Comments
 (0)