llvm.org GIT mirror llvm / 70e34d7
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256938 91177308-0d34-0410-b5e6-96231b3b80d8 Teresa Johnson 3 years ago
1 changed file(s) with 14 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
492492 EXPECT_FALSE(D->isTemporary());
493493 EXPECT_TRUE(T->isTemporary());
494494 }
495
496 #if defined(GTEST_HAS_DEATH_TEST) && !defined(NDEBUG)
497
498 TEST_F(MDNodeTest, deathOnNoReplaceTemporaryRAUW) {
499 auto Temp = MDNode::getTemporary(Context, None);
500 Temp->setCanReplace(false);
501 EXPECT_DEATH(Temp->replaceAllUsesWith(nullptr),
502 "Attempted to replace Metadata marked for no replacement");
503 Temp->setCanReplace(true);
504 // Remove the references to Temp; required for teardown.
505 Temp->replaceAllUsesWith(nullptr);
506 }
507
508 #endif
495509
496510 TEST_F(MDNodeTest, getDistinctWithUnresolvedOperands) {
497511 // temporary !{}