diff options
author | Chris Lattner <clattner@nondot.org> | 2020-04-12 10:44:03 -0700 |
---|---|---|
committer | Chris Lattner <clattner@nondot.org> | 2020-04-12 16:37:17 -0700 |
commit | 89c8ffd54221cfe2d0b5e391974143d08f047ae0 (patch) | |
tree | c5aadd9cba886259982b961a8c56675e5686d813 /llvm/unittests/ADT/StringMapTest.cpp | |
parent | cfb844265aad44668029fce44ddc58adc81ad68a (diff) | |
download | llvm-89c8ffd54221cfe2d0b5e391974143d08f047ae0.zip llvm-89c8ffd54221cfe2d0b5e391974143d08f047ae0.tar.gz llvm-89c8ffd54221cfe2d0b5e391974143d08f047ae0.tar.bz2 |
NFC: Clean up the implementation of StringPool a bit, and remove dependence on some "implicitly MallocAllocator" based methods on StringMapEntry. This allows reducing the #includes in StringMapEntry.h.
Summary:
StringPool has many caveats and isn't used in the monorepo. I will
propose removing it as a patch separate from this refactoring patch.
Reviewers: rriddle
Subscribers: hiraditya, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D77976
Diffstat (limited to 'llvm/unittests/ADT/StringMapTest.cpp')
-rw-r--r-- | llvm/unittests/ADT/StringMapTest.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/unittests/ADT/StringMapTest.cpp b/llvm/unittests/ADT/StringMapTest.cpp index 5f0c83d..fc82c27 100644 --- a/llvm/unittests/ADT/StringMapTest.cpp +++ b/llvm/unittests/ADT/StringMapTest.cpp @@ -224,9 +224,10 @@ TEST_F(StringMapTest, IterationTest) { // Test StringMapEntry::Create() method. TEST_F(StringMapTest, StringMapEntryTest) { + MallocAllocator Allocator; StringMap<uint32_t>::value_type* entry = StringMap<uint32_t>::value_type::Create( - StringRef(testKeyFirst, testKeyLength), 1u); + StringRef(testKeyFirst, testKeyLength), Allocator, 1u); EXPECT_STREQ(testKey, entry->first().data()); EXPECT_EQ(1u, entry->second); free(entry); @@ -353,14 +354,15 @@ TEST_F(StringMapTest, MoveOnly) { StringMap<MoveOnly> t; t.insert(std::make_pair("Test", MoveOnly(42))); StringRef Key = "Test"; - StringMapEntry<MoveOnly>::Create(Key, MoveOnly(42)) - ->Destroy(); + StringMapEntry<MoveOnly>::Create(Key, t.getAllocator(), MoveOnly(42)) + ->Destroy(t.getAllocator()); } TEST_F(StringMapTest, CtorArg) { StringRef Key = "Test"; - StringMapEntry<MoveOnly>::Create(Key, Immovable()) - ->Destroy(); + MallocAllocator Allocator; + StringMapEntry<MoveOnly>::Create(Key, Allocator, Immovable()) + ->Destroy(Allocator); } TEST_F(StringMapTest, MoveConstruct) { |