diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2019-03-09 20:15:01 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2019-03-09 20:15:01 +0000 |
commit | b7db2e9f82422cf18a88711f2f350fe1696a25eb (patch) | |
tree | 6e4eb4d991c01270cf8722a8d9eae1d25512eda5 /clang/unittests/Serialization/InMemoryModuleCacheTest.cpp | |
parent | 2fd0d227f6bc2fa0c03f444eb2be7be303fc3c01 (diff) | |
download | bcm5719-llvm-b7db2e9f82422cf18a88711f2f350fe1696a25eb.tar.gz bcm5719-llvm-b7db2e9f82422cf18a88711f2f350fe1696a25eb.zip |
Stop relying on allocator behaviour in modules unit test
Another fixup for r355778 for Windows bots, this time to stop
accidentally relying on allocator behaviour for the test to pass.
llvm-svn: 355780
Diffstat (limited to 'clang/unittests/Serialization/InMemoryModuleCacheTest.cpp')
-rw-r--r-- | clang/unittests/Serialization/InMemoryModuleCacheTest.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/clang/unittests/Serialization/InMemoryModuleCacheTest.cpp b/clang/unittests/Serialization/InMemoryModuleCacheTest.cpp index 3cba5f59615..ed5e1538eba 100644 --- a/clang/unittests/Serialization/InMemoryModuleCacheTest.cpp +++ b/clang/unittests/Serialization/InMemoryModuleCacheTest.cpp @@ -71,12 +71,15 @@ TEST(InMemoryModuleCacheTest, addBuiltPCM) { } TEST(InMemoryModuleCacheTest, tryToDropPCM) { - auto B = getBuffer(1); - auto *RawB = B.get(); + auto B1 = getBuffer(1); + auto B2 = getBuffer(2); + auto *RawB1 = B1.get(); + auto *RawB2 = B2.get(); + ASSERT_NE(RawB1, RawB2); InMemoryModuleCache Cache; EXPECT_EQ(InMemoryModuleCache::Unknown, Cache.getPCMState("B")); - EXPECT_EQ(RawB, &Cache.addPCM("B", std::move(B))); + EXPECT_EQ(RawB1, &Cache.addPCM("B", std::move(B1))); EXPECT_FALSE(Cache.tryToDropPCM("B")); EXPECT_EQ(nullptr, Cache.lookupPCM("B")); EXPECT_EQ(InMemoryModuleCache::ToBuild, Cache.getPCMState("B")); @@ -90,17 +93,13 @@ TEST(InMemoryModuleCacheTest, tryToDropPCM) { EXPECT_DEATH(Cache.finalizePCM("B"), "Trying to finalize a dropped PCM"); #endif - B = getBuffer(2); - ASSERT_NE(RawB, B.get()); - RawB = B.get(); - // Add a new one. - EXPECT_EQ(RawB, &Cache.addBuiltPCM("B", std::move(B))); + EXPECT_EQ(RawB2, &Cache.addBuiltPCM("B", std::move(B2))); EXPECT_TRUE(Cache.isPCMFinal("B")); // Can try to drop again, but this should error and do nothing. EXPECT_TRUE(Cache.tryToDropPCM("B")); - EXPECT_EQ(RawB, Cache.lookupPCM("B")); + EXPECT_EQ(RawB2, Cache.lookupPCM("B")); } TEST(InMemoryModuleCacheTest, finalizePCM) { |