diff --git a/llvm/include/llvm/ADT/StringMap.h b/llvm/include/llvm/ADT/StringMap.h --- a/llvm/include/llvm/ADT/StringMap.h +++ b/llvm/include/llvm/ADT/StringMap.h @@ -326,7 +326,7 @@ /// if and only if the insertion takes place, and the iterator component of /// the pair points to the element with key equivalent to the key of the pair. template - std::pair try_emplace(StringRef Key, ArgsTy &&... Args) { + std::pair try_emplace(StringRef Key, ArgsTy &&...Args) { unsigned BucketNo = LookupBucketFor(Key); StringMapEntryBase *&Bucket = TheTable[BucketNo]; if (Bucket && Bucket != getTombstoneVal()) diff --git a/llvm/include/llvm/ADT/StringMapEntry.h b/llvm/include/llvm/ADT/StringMapEntry.h --- a/llvm/include/llvm/ADT/StringMapEntry.h +++ b/llvm/include/llvm/ADT/StringMapEntry.h @@ -17,8 +17,8 @@ #define LLVM_ADT_STRINGMAPENTRY_H #include "llvm/ADT/None.h" -#include "llvm/ADT/StringRef.h" #include "llvm/ADT/STLFunctionalExtras.h" +#include "llvm/ADT/StringRef.h" namespace llvm { @@ -74,7 +74,7 @@ explicit StringMapEntryStorage(size_t keyLength) : StringMapEntryBase(keyLength), second() {} template - StringMapEntryStorage(size_t keyLength, InitTy &&... initVals) + StringMapEntryStorage(size_t keyLength, InitTy &&...initVals) : StringMapEntryBase(keyLength), second(std::forward(initVals)...) {} StringMapEntryStorage(StringMapEntryStorage &e) = delete; @@ -121,7 +121,7 @@ /// \p InitiVals. template static StringMapEntry *Create(StringRef key, AllocatorTy &allocator, - InitTy &&... initVals) { + InitTy &&...initVals) { return new (StringMapEntryBase::allocateWithKey( sizeof(StringMapEntry), alignof(StringMapEntry), key, allocator)) StringMapEntry(key.size(), std::forward(initVals)...); diff --git a/llvm/unittests/ADT/StringMapTest.cpp b/llvm/unittests/ADT/StringMapTest.cpp --- a/llvm/unittests/ADT/StringMapTest.cpp +++ b/llvm/unittests/ADT/StringMapTest.cpp @@ -28,7 +28,7 @@ static const char testKey[]; static const uint32_t testValue; - static const char* testKeyFirst; + static const char *testKeyFirst; static size_t testKeyLength; static const std::string testKeyStr; @@ -45,7 +45,7 @@ EXPECT_EQ(0u, testMap.count(StringRef(testKeyFirst, testKeyLength))); EXPECT_EQ(0u, testMap.count(testKeyStr)); EXPECT_TRUE(testMap.find(testKey) == testMap.end()); - EXPECT_TRUE(testMap.find(StringRef(testKeyFirst, testKeyLength)) == + EXPECT_TRUE(testMap.find(StringRef(testKeyFirst, testKeyLength)) == testMap.end()); EXPECT_TRUE(testMap.find(testKeyStr) == testMap.end()); } @@ -68,7 +68,7 @@ EXPECT_EQ(1u, testMap.count(StringRef(testKeyFirst, testKeyLength))); EXPECT_EQ(1u, testMap.count(testKeyStr)); EXPECT_TRUE(testMap.find(testKey) == testMap.begin()); - EXPECT_TRUE(testMap.find(StringRef(testKeyFirst, testKeyLength)) == + EXPECT_TRUE(testMap.find(StringRef(testKeyFirst, testKeyLength)) == testMap.begin()); EXPECT_TRUE(testMap.find(testKeyStr) == testMap.begin()); } @@ -76,7 +76,7 @@ const char StringMapTest::testKey[] = "key"; const uint32_t StringMapTest::testValue = 1u; -const char* StringMapTest::testKeyFirst = testKey; +const char *StringMapTest::testKeyFirst = testKey; size_t StringMapTest::testKeyLength = sizeof(testKey) - 1; const std::string StringMapTest::testKeyStr(testKey); @@ -91,13 +91,11 @@ }; // Empty map tests. -TEST_F(StringMapTest, EmptyMapTest) { - assertEmptyMap(); -} +TEST_F(StringMapTest, EmptyMapTest) { assertEmptyMap(); } // Constant map tests. TEST_F(StringMapTest, ConstEmptyMapTest) { - const StringMap& constTestMap = testMap; + const StringMap &constTestMap = testMap; // Size tests EXPECT_EQ(0u, constTestMap.size()); @@ -220,8 +218,8 @@ } // Iterate over all numbers and mark each one found. - for (StringMap::iterator it = testMap.begin(); - it != testMap.end(); ++it) { + for (StringMap::iterator it = testMap.begin(); it != testMap.end(); + ++it) { std::stringstream ss; ss << "key_" << it->second; ASSERT_STREQ(ss.str().c_str(), it->first().data()); @@ -248,10 +246,8 @@ // Test insert() method. TEST_F(StringMapTest, InsertTest) { SCOPED_TRACE("InsertTest"); - testMap.insert( - StringMap::value_type::Create( - StringRef(testKeyFirst, testKeyLength), - testMap.getAllocator(), 1u)); + testMap.insert(StringMap::value_type::Create( + StringRef(testKeyFirst, testKeyLength), testMap.getAllocator(), 1u)); assertSingleItemMap(); } @@ -286,7 +282,7 @@ EXPECT_EQ(0u, t.getNumBuckets()); StringMap::iterator It = - t.insert(std::make_pair("abcdef", 42)).first; + t.insert(std::make_pair("abcdef", 42)).first; EXPECT_EQ(16u, t.getNumBuckets()); EXPECT_EQ("abcdef", It->first()); EXPECT_EQ(42u, It->second); @@ -358,13 +354,13 @@ struct Immovable { Immovable() {} - Immovable(Immovable&&) = delete; // will disable the other special members + Immovable(Immovable &&) = delete; // will disable the other special members }; struct MoveOnly { int i; MoveOnly(int i) : i(i) {} - MoveOnly(const Immovable&) : i(0) {} + MoveOnly(const Immovable &) : i(0) {} MoveOnly(MoveOnly &&RHS) : i(RHS.i) {} MoveOnly &operator=(MoveOnly &&RHS) { i = RHS.i; @@ -590,7 +586,7 @@ NonMoveableNonCopyableType(const NonMoveableNonCopyableType &) = delete; NonMoveableNonCopyableType(NonMoveableNonCopyableType &&) = delete; }; -} +} // namespace // Test that we can "emplace" an element in the map without involving map/move TEST(StringMapCustomTest, EmplaceTest) {