Skip to content

Commit

Permalink
Missed formatting
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208362 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
dwblaikie committed May 8, 2014
1 parent 2b94fa7 commit 50f8a53
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
9 changes: 6 additions & 3 deletions include/llvm/ADT/StringMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ class StringMapImpl {
: TheTable(nullptr),
// Initialize the map with zero buckets to allocation.
NumBuckets(0), NumItems(0), NumTombstones(0), ItemSize(itemSize) {}
StringMapImpl(StringMapImpl &&RHS) : TheTable(RHS.TheTable), NumBuckets(RHS.NumBuckets), NumItems(RHS.NumItems), NumTombstones(RHS.NumTombstones), ItemSize(RHS.ItemSize) {
StringMapImpl(StringMapImpl &&RHS)
: TheTable(RHS.TheTable), NumBuckets(RHS.NumBuckets),
NumItems(RHS.NumItems), NumTombstones(RHS.NumTombstones),
ItemSize(RHS.ItemSize) {
RHS.TheTable = nullptr;
RHS.NumBuckets = 0;
RHS.NumItems = 0;
Expand Down Expand Up @@ -115,7 +118,7 @@ class StringMapEntry : public StringMapEntryBase {
explicit StringMapEntry(unsigned strLen)
: StringMapEntryBase(strLen), second() {}
StringMapEntry(unsigned strLen, ValueTy V)
: StringMapEntryBase(strLen), second(std::move(V)) {}
: StringMapEntryBase(strLen), second(std::move(V)) {}

StringRef getKey() const {
return StringRef(getKeyData(), getKeyLength());
Expand Down Expand Up @@ -351,7 +354,7 @@ class StringMap : public StringMapImpl {
return *static_cast<MapEntryTy*>(Bucket);

MapEntryTy *NewItem =
MapEntryTy::Create(Key.begin(), Key.end(), Allocator, std::move(Val));
MapEntryTy::Create(Key.begin(), Key.end(), Allocator, std::move(Val));

if (Bucket == getTombstoneVal())
--NumTombstones;
Expand Down
22 changes: 11 additions & 11 deletions unittests/ADT/StringMapTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,17 +221,18 @@ TEST_F(StringMapTest, NonDefaultConstructable) {
struct MoveOnly {
int i;
MoveOnly(int i) : i(i) {}
MoveOnly(MoveOnly&&) = default;
MoveOnly(const MoveOnly&) = delete;
MoveOnly &operator=(MoveOnly&&) = default;
MoveOnly &operator=(const MoveOnly&) = delete;
MoveOnly(MoveOnly &&) = default;
MoveOnly(const MoveOnly &) = delete;
MoveOnly &operator=(MoveOnly &&) = default;
MoveOnly &operator=(const MoveOnly &) = delete;
};

TEST_F(StringMapTest, MoveOnlyKey) {
StringMap<MoveOnly> t;
t.GetOrCreateValue("Test", MoveOnly(42));
StringRef Key = "Test";
StringMapEntry<MoveOnly>::Create(Key.begin(), Key.end(), MoveOnly(42))->Destroy();
StringMapEntry<MoveOnly>::Create(Key.begin(), Key.end(), MoveOnly(42))
->Destroy();
}

TEST_F(StringMapTest, MoveConstruct) {
Expand Down Expand Up @@ -259,24 +260,23 @@ TEST_F(StringMapTest, MoveAssignment) {
struct Countable {
int &InstanceCount;
int Number;
Countable(int Number, int &InstanceCount) :InstanceCount(InstanceCount), Number(Number) {
Countable(int Number, int &InstanceCount)
: InstanceCount(InstanceCount), Number(Number) {
++InstanceCount;
}
Countable(Countable &&C) : InstanceCount(C.InstanceCount), Number(C.Number) {
++InstanceCount;
C.Number = -1;
}
Countable(const Countable &C) : InstanceCount(C.InstanceCount), Number(C.Number) {
Countable(const Countable &C)
: InstanceCount(C.InstanceCount), Number(C.Number) {
++InstanceCount;
}
Countable &operator=(Countable C) {
Number = C.Number;
return *this;
}
~Countable() {
--InstanceCount;
}

~Countable() { --InstanceCount; }
};

TEST_F(StringMapTest, MoveDtor) {
Expand Down

0 comments on commit 50f8a53

Please sign in to comment.