@@ -136,12 +136,12 @@ class SmallPtrSetImplBase : public DebugEpochBase {
136
136
}
137
137
138
138
protected:
139
- static void *getTombstoneMarker () { return reinterpret_cast <void *>(-2 ); }
139
+ static void *getTombstoneMarker () { return reinterpret_cast <void *>(-2 ); }
140
140
141
141
static void *getEmptyMarker () {
142
142
// Note that -1 is chosen to make clear() efficiently implementable with
143
143
// memset and because it's not a valid pointer value.
144
- return reinterpret_cast <void *>(-1 );
144
+ return reinterpret_cast <void *>(-1 );
145
145
}
146
146
147
147
const void **EndPointer () const {
@@ -190,7 +190,7 @@ class SmallPtrSetImplBase : public DebugEpochBase {
190
190
// / return true, otherwise return false. This is hidden from the client so
191
191
// / that the derived class can check that the right type of pointer is passed
192
192
// / in.
193
- bool erase_imp (const void * Ptr) {
193
+ bool erase_imp (const void *Ptr) {
194
194
if (isSmall ()) {
195
195
for (const void *&Bucket : small_buckets ()) {
196
196
if (Bucket == Ptr) {
@@ -218,7 +218,7 @@ class SmallPtrSetImplBase : public DebugEpochBase {
218
218
// / Returns the raw pointer needed to construct an iterator. If element not
219
219
// / found, this will be EndPointer. Otherwise, it will be a pointer to the
220
220
// / slot which stores Ptr;
221
- const void *const * find_imp (const void * Ptr) const {
221
+ const void *const *find_imp (const void *Ptr) const {
222
222
if (isSmall ()) {
223
223
// Linear search for the item.
224
224
for (const void *const &Bucket : small_buckets ())
@@ -251,7 +251,7 @@ class SmallPtrSetImplBase : public DebugEpochBase {
251
251
LLVM_ABI std::pair<const void *const *, bool > insert_imp_big (const void *Ptr);
252
252
253
253
LLVM_ABI const void *const *doFind (const void *Ptr) const ;
254
- const void * const *FindBucketFor (const void *Ptr) const ;
254
+ const void *const *FindBucketFor (const void *Ptr) const ;
255
255
LLVM_ABI void shrink_and_clear ();
256
256
257
257
// / Grow - Allocate a larger backing store for the buckets and move it over.
@@ -285,8 +285,8 @@ class SmallPtrSetIteratorImpl {
285
285
const void *const *End;
286
286
287
287
public:
288
- explicit SmallPtrSetIteratorImpl (const void *const *BP, const void *const *E)
289
- : Bucket(BP), End(E) {
288
+ explicit SmallPtrSetIteratorImpl (const void *const *BP, const void *const *E)
289
+ : Bucket(BP), End(E) {
290
290
if (shouldReverseIterate ()) {
291
291
RetreatIfNotValid ();
292
292
return ;
@@ -349,10 +349,10 @@ class LLVM_DEBUGEPOCHBASE_HANDLEBASE_EMPTYBASE SmallPtrSetIterator
349
349
return PtrTraits::getFromVoidPointer (const_cast <void *>(Bucket[-1 ]));
350
350
}
351
351
assert (Bucket < End);
352
- return PtrTraits::getFromVoidPointer (const_cast <void *>(*Bucket));
352
+ return PtrTraits::getFromVoidPointer (const_cast <void *>(*Bucket));
353
353
}
354
354
355
- inline SmallPtrSetIterator& operator ++() { // Preincrement
355
+ inline SmallPtrSetIterator & operator ++() { // Preincrement
356
356
assert (isHandleInSync () && " invalid iterator access!" );
357
357
if (shouldReverseIterate ()) {
358
358
--Bucket;
@@ -364,7 +364,7 @@ class LLVM_DEBUGEPOCHBASE_HANDLEBASE_EMPTYBASE SmallPtrSetIterator
364
364
return *this ;
365
365
}
366
366
367
- SmallPtrSetIterator operator ++(int ) { // Postincrement
367
+ SmallPtrSetIterator operator ++(int ) { // Postincrement
368
368
SmallPtrSetIterator tmp = *this ;
369
369
++*this ;
370
370
return tmp;
@@ -376,8 +376,7 @@ class LLVM_DEBUGEPOCHBASE_HANDLEBASE_EMPTYBASE SmallPtrSetIterator
376
376
// /
377
377
// / This is particularly useful for passing around between interface boundaries
378
378
// / to avoid encoding a particular small size in the interface boundary.
379
- template <typename PtrType>
380
- class SmallPtrSetImpl : public SmallPtrSetImplBase {
379
+ template <typename PtrType> class SmallPtrSetImpl : public SmallPtrSetImplBase {
381
380
using ConstPtrType = typename add_const_past_pointer<PtrType>::type;
382
381
using PtrTraits = PointerLikeTypeTraits<PtrType>;
383
382
using ConstPtrTraits = PointerLikeTypeTraits<ConstPtrType>;
@@ -406,9 +405,7 @@ class SmallPtrSetImpl : public SmallPtrSetImplBase {
406
405
// / Insert the given pointer with an iterator hint that is ignored. This is
407
406
// / identical to calling insert(Ptr), but allows SmallPtrSet to be used by
408
407
// / std::insert_iterator and std::inserter().
409
- iterator insert (iterator, PtrType Ptr) {
410
- return insert (Ptr).first ;
411
- }
408
+ iterator insert (iterator, PtrType Ptr) { return insert (Ptr).first ; }
412
409
413
410
// / Remove pointer from the set.
414
411
// /
@@ -431,8 +428,7 @@ class SmallPtrSetImpl : public SmallPtrSetImplBase {
431
428
// / Returns whether anything was removed. It is safe to read the set inside
432
429
// / the predicate function. However, the predicate must not modify the set
433
430
// / itself, only indicate a removal by returning true.
434
- template <typename UnaryPredicate>
435
- bool remove_if (UnaryPredicate P) {
431
+ template <typename UnaryPredicate> bool remove_if (UnaryPredicate P) {
436
432
bool Removed = false ;
437
433
if (isSmall ()) {
438
434
auto Buckets = small_buckets ();
@@ -477,8 +473,7 @@ class SmallPtrSetImpl : public SmallPtrSetImplBase {
477
473
return contains_imp (ConstPtrTraits::getAsVoidPointer (Ptr));
478
474
}
479
475
480
- template <typename IterT>
481
- void insert (IterT I, IterT E) {
476
+ template <typename IterT> void insert (IterT I, IterT E) {
482
477
for (; I != E; ++I)
483
478
insert (*I);
484
479
}
@@ -537,7 +532,7 @@ bool operator!=(const SmallPtrSetImpl<PtrType> &LHS,
537
532
// / SmallSize or less elements. This internally rounds up SmallSize to the next
538
533
// / power of two if it is not already a power of two. See the comments above
539
534
// / SmallPtrSetImplBase for details of the algorithm.
540
- template <class PtrType , unsigned SmallSize>
535
+ template <class PtrType , unsigned SmallSize>
541
536
class SmallPtrSet : public SmallPtrSetImpl <PtrType> {
542
537
// In small mode SmallPtrSet uses linear search for the elements, so it is
543
538
// not a good idea to choose this value too high. You may consider using a
@@ -568,7 +563,7 @@ class SmallPtrSet : public SmallPtrSetImpl<PtrType> {
568
563
: BaseT(SmallStorage, SmallSizePowTwo, that.SmallStorage,
569
564
std::move (that)) {}
570
565
571
- template <typename It>
566
+ template <typename It>
572
567
SmallPtrSet (It I, It E) : BaseT(SmallStorage, SmallSizePowTwo) {
573
568
this ->insert (I, E);
574
569
}
@@ -610,16 +605,16 @@ class SmallPtrSet : public SmallPtrSetImpl<PtrType> {
610
605
}
611
606
};
612
607
613
- } // end namespace llvm
608
+ } // namespace llvm
614
609
615
610
namespace std {
616
611
617
- // / Implement std::swap in terms of SmallPtrSet swap.
618
- template <class T , unsigned N>
619
- inline void swap (llvm::SmallPtrSet<T, N> &LHS, llvm::SmallPtrSet<T, N> &RHS) {
620
- LHS.swap (RHS);
621
- }
612
+ // / Implement std::swap in terms of SmallPtrSet swap.
613
+ template <class T , unsigned N>
614
+ inline void swap (llvm::SmallPtrSet<T, N> &LHS, llvm::SmallPtrSet<T, N> &RHS) {
615
+ LHS.swap (RHS);
616
+ }
622
617
623
- } // end namespace std
618
+ } // namespace std
624
619
625
620
#endif // LLVM_ADT_SMALLPTRSET_H
0 commit comments