Skip to content

Commit 188de71

Browse files
kazutakahiratamahesh-attarde
authored andcommitted
[ADT] clang-format SmallPtrSet.h (NFC)
I'm planning to modify this file.
1 parent 6cb90e5 commit 188de71

File tree

1 file changed

+23
-28
lines changed

1 file changed

+23
-28
lines changed

llvm/include/llvm/ADT/SmallPtrSet.h

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ class SmallPtrSetImplBase : public DebugEpochBase {
136136
}
137137

138138
protected:
139-
static void *getTombstoneMarker() { return reinterpret_cast<void*>(-2); }
139+
static void *getTombstoneMarker() { return reinterpret_cast<void *>(-2); }
140140

141141
static void *getEmptyMarker() {
142142
// Note that -1 is chosen to make clear() efficiently implementable with
143143
// memset and because it's not a valid pointer value.
144-
return reinterpret_cast<void*>(-1);
144+
return reinterpret_cast<void *>(-1);
145145
}
146146

147147
const void **EndPointer() const {
@@ -190,7 +190,7 @@ class SmallPtrSetImplBase : public DebugEpochBase {
190190
/// return true, otherwise return false. This is hidden from the client so
191191
/// that the derived class can check that the right type of pointer is passed
192192
/// in.
193-
bool erase_imp(const void * Ptr) {
193+
bool erase_imp(const void *Ptr) {
194194
if (isSmall()) {
195195
for (const void *&Bucket : small_buckets()) {
196196
if (Bucket == Ptr) {
@@ -218,7 +218,7 @@ class SmallPtrSetImplBase : public DebugEpochBase {
218218
/// Returns the raw pointer needed to construct an iterator. If element not
219219
/// found, this will be EndPointer. Otherwise, it will be a pointer to the
220220
/// slot which stores Ptr;
221-
const void *const * find_imp(const void * Ptr) const {
221+
const void *const *find_imp(const void *Ptr) const {
222222
if (isSmall()) {
223223
// Linear search for the item.
224224
for (const void *const &Bucket : small_buckets())
@@ -251,7 +251,7 @@ class SmallPtrSetImplBase : public DebugEpochBase {
251251
LLVM_ABI std::pair<const void *const *, bool> insert_imp_big(const void *Ptr);
252252

253253
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;
255255
LLVM_ABI void shrink_and_clear();
256256

257257
/// Grow - Allocate a larger backing store for the buckets and move it over.
@@ -285,8 +285,8 @@ class SmallPtrSetIteratorImpl {
285285
const void *const *End;
286286

287287
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) {
290290
if (shouldReverseIterate()) {
291291
RetreatIfNotValid();
292292
return;
@@ -349,10 +349,10 @@ class LLVM_DEBUGEPOCHBASE_HANDLEBASE_EMPTYBASE SmallPtrSetIterator
349349
return PtrTraits::getFromVoidPointer(const_cast<void *>(Bucket[-1]));
350350
}
351351
assert(Bucket < End);
352-
return PtrTraits::getFromVoidPointer(const_cast<void*>(*Bucket));
352+
return PtrTraits::getFromVoidPointer(const_cast<void *>(*Bucket));
353353
}
354354

355-
inline SmallPtrSetIterator& operator++() { // Preincrement
355+
inline SmallPtrSetIterator &operator++() { // Preincrement
356356
assert(isHandleInSync() && "invalid iterator access!");
357357
if (shouldReverseIterate()) {
358358
--Bucket;
@@ -364,7 +364,7 @@ class LLVM_DEBUGEPOCHBASE_HANDLEBASE_EMPTYBASE SmallPtrSetIterator
364364
return *this;
365365
}
366366

367-
SmallPtrSetIterator operator++(int) { // Postincrement
367+
SmallPtrSetIterator operator++(int) { // Postincrement
368368
SmallPtrSetIterator tmp = *this;
369369
++*this;
370370
return tmp;
@@ -376,8 +376,7 @@ class LLVM_DEBUGEPOCHBASE_HANDLEBASE_EMPTYBASE SmallPtrSetIterator
376376
///
377377
/// This is particularly useful for passing around between interface boundaries
378378
/// 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 {
381380
using ConstPtrType = typename add_const_past_pointer<PtrType>::type;
382381
using PtrTraits = PointerLikeTypeTraits<PtrType>;
383382
using ConstPtrTraits = PointerLikeTypeTraits<ConstPtrType>;
@@ -406,9 +405,7 @@ class SmallPtrSetImpl : public SmallPtrSetImplBase {
406405
/// Insert the given pointer with an iterator hint that is ignored. This is
407406
/// identical to calling insert(Ptr), but allows SmallPtrSet to be used by
408407
/// 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; }
412409

413410
/// Remove pointer from the set.
414411
///
@@ -431,8 +428,7 @@ class SmallPtrSetImpl : public SmallPtrSetImplBase {
431428
/// Returns whether anything was removed. It is safe to read the set inside
432429
/// the predicate function. However, the predicate must not modify the set
433430
/// 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) {
436432
bool Removed = false;
437433
if (isSmall()) {
438434
auto Buckets = small_buckets();
@@ -477,8 +473,7 @@ class SmallPtrSetImpl : public SmallPtrSetImplBase {
477473
return contains_imp(ConstPtrTraits::getAsVoidPointer(Ptr));
478474
}
479475

480-
template <typename IterT>
481-
void insert(IterT I, IterT E) {
476+
template <typename IterT> void insert(IterT I, IterT E) {
482477
for (; I != E; ++I)
483478
insert(*I);
484479
}
@@ -537,7 +532,7 @@ bool operator!=(const SmallPtrSetImpl<PtrType> &LHS,
537532
/// SmallSize or less elements. This internally rounds up SmallSize to the next
538533
/// power of two if it is not already a power of two. See the comments above
539534
/// SmallPtrSetImplBase for details of the algorithm.
540-
template<class PtrType, unsigned SmallSize>
535+
template <class PtrType, unsigned SmallSize>
541536
class SmallPtrSet : public SmallPtrSetImpl<PtrType> {
542537
// In small mode SmallPtrSet uses linear search for the elements, so it is
543538
// not a good idea to choose this value too high. You may consider using a
@@ -568,7 +563,7 @@ class SmallPtrSet : public SmallPtrSetImpl<PtrType> {
568563
: BaseT(SmallStorage, SmallSizePowTwo, that.SmallStorage,
569564
std::move(that)) {}
570565

571-
template<typename It>
566+
template <typename It>
572567
SmallPtrSet(It I, It E) : BaseT(SmallStorage, SmallSizePowTwo) {
573568
this->insert(I, E);
574569
}
@@ -610,16 +605,16 @@ class SmallPtrSet : public SmallPtrSetImpl<PtrType> {
610605
}
611606
};
612607

613-
} // end namespace llvm
608+
} // namespace llvm
614609

615610
namespace std {
616611

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+
}
622617

623-
} // end namespace std
618+
} // namespace std
624619

625620
#endif // LLVM_ADT_SMALLPTRSET_H

0 commit comments

Comments
 (0)