[llvm] r259017 - SmallPtrSet: Remove trailing whitespace, fix indentation
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 27 20:49:08 PST 2016
Author: matze
Date: Wed Jan 27 22:49:07 2016
New Revision: 259017
URL: http://llvm.org/viewvc/llvm-project?rev=259017&view=rev
Log:
SmallPtrSet: Remove trailing whitespace, fix indentation
Modified:
llvm/trunk/include/llvm/ADT/SmallPtrSet.h
llvm/trunk/lib/Support/SmallPtrSet.cpp
Modified: llvm/trunk/include/llvm/ADT/SmallPtrSet.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/SmallPtrSet.h?rev=259017&r1=259016&r2=259017&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/SmallPtrSet.h (original)
+++ llvm/trunk/include/llvm/ADT/SmallPtrSet.h Wed Jan 27 22:49:07 2016
@@ -63,9 +63,10 @@ protected:
unsigned NumTombstones;
// Helpers to copy and move construct a SmallPtrSet.
- SmallPtrSetImplBase(const void **SmallStorage, const SmallPtrSetImplBase &that);
+ SmallPtrSetImplBase(const void **SmallStorage,
+ const SmallPtrSetImplBase &that);
SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize,
- SmallPtrSetImplBase &&that);
+ SmallPtrSetImplBase &&that);
explicit SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize) :
SmallArray(SmallStorage), CurArray(SmallStorage), CurArraySize(SmallSize) {
assert(SmallSize && (SmallSize & (SmallSize-1)) == 0 &&
@@ -172,7 +173,7 @@ protected:
public:
explicit SmallPtrSetIteratorImpl(const void *const *BP, const void*const *E)
: Bucket(BP), End(E) {
- AdvanceIfNotValid();
+ AdvanceIfNotValid();
}
bool operator==(const SmallPtrSetIteratorImpl &RHS) const {
Modified: llvm/trunk/lib/Support/SmallPtrSet.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SmallPtrSet.cpp?rev=259017&r1=259016&r2=259017&view=diff
==============================================================================
--- llvm/trunk/lib/Support/SmallPtrSet.cpp (original)
+++ llvm/trunk/lib/Support/SmallPtrSet.cpp Wed Jan 27 22:49:07 2016
@@ -45,7 +45,7 @@ SmallPtrSetImplBase::insert_imp_big(cons
// tombstones), rehash.
Grow(CurArraySize);
}
-
+
// Okay, we know we have space. Find a hash bucket.
const void **Bucket = const_cast<const void**>(FindBucketFor(Ptr));
if (*Bucket == Ptr)
@@ -71,10 +71,10 @@ bool SmallPtrSetImplBase::erase_imp(cons
--NumElements;
return true;
}
-
+
return false;
}
-
+
// Okay, we know we have space. Find a hash bucket.
void **Bucket = const_cast<void**>(FindBucketFor(Ptr));
if (*Bucket != Ptr) return false; // Not in the set?
@@ -107,7 +107,7 @@ const void * const *SmallPtrSetImplBase:
// prefer to return it than something that would require more probing.
if (Array[Bucket] == getTombstoneMarker() && !Tombstone)
Tombstone = Array+Bucket; // Remember the first tombstone found.
-
+
// It's a hash collision or a tombstone. Reprobe.
Bucket = (Bucket + ProbeAmt++) & (ArraySize-1);
}
@@ -118,16 +118,16 @@ const void * const *SmallPtrSetImplBase:
void SmallPtrSetImplBase::Grow(unsigned NewSize) {
// Allocate at twice as many buckets, but at least 128.
unsigned OldSize = CurArraySize;
-
+
const void **OldBuckets = CurArray;
bool WasSmall = isSmall();
-
+
// Install the new array. Clear all the buckets to empty.
CurArray = (const void**)malloc(sizeof(void*) * NewSize);
assert(CurArray && "Failed to allocate memory?");
CurArraySize = NewSize;
memset(CurArray, -1, NewSize*sizeof(void*));
-
+
// Copy over all the elements.
if (WasSmall) {
// Small sets store their elements in order.
@@ -145,14 +145,14 @@ void SmallPtrSetImplBase::Grow(unsigned
if (Elt != getTombstoneMarker() && Elt != getEmptyMarker())
*const_cast<void**>(FindBucketFor(Elt)) = const_cast<void*>(Elt);
}
-
+
free(OldBuckets);
NumTombstones = 0;
}
}
SmallPtrSetImplBase::SmallPtrSetImplBase(const void **SmallStorage,
- const SmallPtrSetImplBase& that) {
+ const SmallPtrSetImplBase &that) {
SmallArray = SmallStorage;
// If we're becoming small, prepare to insert into our stack space
@@ -163,13 +163,13 @@ SmallPtrSetImplBase::SmallPtrSetImplBase
CurArray = (const void**)malloc(sizeof(void*) * that.CurArraySize);
assert(CurArray && "Failed to allocate memory?");
}
-
+
// Copy over the new array size
CurArraySize = that.CurArraySize;
// Copy over the contents from the other set
memcpy(CurArray, that.CurArray, sizeof(void*)*CurArraySize);
-
+
NumElements = that.NumElements;
NumTombstones = that.NumTombstones;
}
@@ -228,13 +228,13 @@ void SmallPtrSetImplBase::CopyFrom(const
}
assert(CurArray && "Failed to allocate memory?");
}
-
+
// Copy over the new array size
CurArraySize = RHS.CurArraySize;
// Copy over the contents from the other set
memcpy(CurArray, RHS.CurArray, sizeof(void*)*CurArraySize);
-
+
NumElements = RHS.NumElements;
NumTombstones = RHS.NumTombstones;
}
More information about the llvm-commits
mailing list