diff options
Diffstat (limited to 'llvm/unittests/Transforms/Utils/CloningTest.cpp')
-rw-r--r-- | llvm/unittests/Transforms/Utils/CloningTest.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/llvm/unittests/Transforms/Utils/CloningTest.cpp b/llvm/unittests/Transforms/Utils/CloningTest.cpp index 34802b6..77b2c2c 100644 --- a/llvm/unittests/Transforms/Utils/CloningTest.cpp +++ b/llvm/unittests/Transforms/Utils/CloningTest.cpp @@ -921,6 +921,10 @@ protected: IBuilder.SetInsertPoint(Entry); IBuilder.CreateRetVoid(); + auto *G = + Function::Create(FuncType, GlobalValue::ExternalLinkage, "g", OldM); + G->addMetadata(LLVMContext::MD_type, *MDNode::get(C, {})); + // Finalize the debug info DBuilder.finalize(); } @@ -934,10 +938,10 @@ protected: TEST_F(CloneModule, Verify) { // Confirm the old module is (still) valid. - EXPECT_FALSE(verifyModule(*OldM)); + EXPECT_FALSE(verifyModule(*OldM, &errs())); // Check the new module. - EXPECT_FALSE(verifyModule(*NewM)); + EXPECT_FALSE(verifyModule(*NewM, &errs())); } TEST_F(CloneModule, OldModuleUnchanged) { @@ -955,6 +959,11 @@ TEST_F(CloneModule, Subprogram) { EXPECT_EQ(SP->getLine(), (unsigned)4); } +TEST_F(CloneModule, FunctionDeclarationMetadata) { + Function *NewF = NewM->getFunction("g"); + EXPECT_NE(nullptr, NewF->getMetadata(LLVMContext::MD_type)); +} + TEST_F(CloneModule, GlobalMetadata) { GlobalVariable *NewGV = NewM->getGlobalVariable("gv"); EXPECT_NE(nullptr, NewGV->getMetadata(LLVMContext::MD_type)); |