summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/IR/MetadataTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/IR/MetadataTest.cpp')
-rw-r--r--llvm/unittests/IR/MetadataTest.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index 7b9b7c4d898..c66bbde8182 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/unittests/IR/MetadataTest.cpp
@@ -117,9 +117,8 @@ protected:
32, 32, 0, DINode::FlagZero, nullptr, 0, nullptr, nullptr, "");
}
Function *getFunction(StringRef Name) {
- return Function::Create(
- FunctionType::get(Type::getVoidTy(Context), None, false),
- Function::ExternalLinkage, Name, M);
+ return cast<Function>(M.getOrInsertFunction(
+ Name, FunctionType::get(Type::getVoidTy(Context), None, false)));
}
};
typedef MetadataTest MDStringTest;
OpenPOWER on IntegriCloud