mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-10 22:00:58 +00:00
Add unittest for new CanReplace flag on MDNodes
This adds a unittest for the support added in r256648 to add a flag that can be used to prevent RAUW on temporary metadata used as a map key. llvm-svn: 256938
This commit is contained in:
parent
787f659237
commit
ae16c1fff2
@ -494,6 +494,20 @@ TEST_F(MDNodeTest, isTemporary) {
|
||||
EXPECT_TRUE(T->isTemporary());
|
||||
}
|
||||
|
||||
#if defined(GTEST_HAS_DEATH_TEST) && !defined(NDEBUG)
|
||||
|
||||
TEST_F(MDNodeTest, deathOnNoReplaceTemporaryRAUW) {
|
||||
auto Temp = MDNode::getTemporary(Context, None);
|
||||
Temp->setCanReplace(false);
|
||||
EXPECT_DEATH(Temp->replaceAllUsesWith(nullptr),
|
||||
"Attempted to replace Metadata marked for no replacement");
|
||||
Temp->setCanReplace(true);
|
||||
// Remove the references to Temp; required for teardown.
|
||||
Temp->replaceAllUsesWith(nullptr);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
TEST_F(MDNodeTest, getDistinctWithUnresolvedOperands) {
|
||||
// temporary !{}
|
||||
auto Temp = MDTuple::getTemporary(Context, None);
|
||||
|
Loading…
x
Reference in New Issue
Block a user