summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/IR/CFGBuilder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/IR/CFGBuilder.cpp')
-rw-r--r--llvm/unittests/IR/CFGBuilder.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/unittests/IR/CFGBuilder.cpp b/llvm/unittests/IR/CFGBuilder.cpp
index 1ce598799ca..a2016f7e6cb 100644
--- a/llvm/unittests/IR/CFGBuilder.cpp
+++ b/llvm/unittests/IR/CFGBuilder.cpp
@@ -23,7 +23,7 @@ CFGHolder::CFGHolder(StringRef ModuleName, StringRef FunctionName)
: Context(llvm::make_unique<LLVMContext>()),
M(llvm::make_unique<Module>(ModuleName, *Context)) {
FunctionType *FTy = FunctionType::get(Type::getVoidTy(*Context), {}, false);
- F = Function::Create(FTy, Function::ExternalLinkage, FunctionName, M.get());
+ F = cast<Function>(M->getOrInsertFunction(FunctionName, FTy));
}
CFGHolder::~CFGHolder() = default;
OpenPOWER on IntegriCloud