diff options
author | Florian Hahn <florian.hahn@arm.com> | 2018-04-19 12:06:26 +0000 |
---|---|---|
committer | Florian Hahn <florian.hahn@arm.com> | 2018-04-19 12:06:26 +0000 |
commit | 2342533e1a448c4e1fdb4dab27fdb9e054dfc8bb (patch) | |
tree | f1fd653f6cd503b8938677d8c8d5d9e41e21e8c3 /llvm/unittests/IR/BasicBlockTest.cpp | |
parent | 3c06617f0e1dbef3886066bd83618670e40c7311 (diff) | |
download | bcm5719-llvm-2342533e1a448c4e1fdb4dab27fdb9e054dfc8bb.tar.gz bcm5719-llvm-2342533e1a448c4e1fdb4dab27fdb9e054dfc8bb.zip |
[IR/BasicBlockTest] Fix asan failure introduced in rL330316.
The argument has to be deleted after the module containing the function
gets deleted.
llvm-svn: 330320
Diffstat (limited to 'llvm/unittests/IR/BasicBlockTest.cpp')
-rw-r--r-- | llvm/unittests/IR/BasicBlockTest.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/llvm/unittests/IR/BasicBlockTest.cpp b/llvm/unittests/IR/BasicBlockTest.cpp index cf950501aec..5e3b11e434b 100644 --- a/llvm/unittests/IR/BasicBlockTest.cpp +++ b/llvm/unittests/IR/BasicBlockTest.cpp @@ -83,19 +83,19 @@ TEST(BasicBlockTest, PhiRange) { for (auto Pair : zip(Range1, Range2)) \ EXPECT_EQ(&std::get<0>(Pair), std::get<1>(Pair)); -TEST(BasicBlockTest, TestSkipInsts) { +TEST(BasicBlockTest, TestInstructionsWithoutDebug) { LLVMContext Ctx; - std::unique_ptr<Module> M(new Module("MyModule", Ctx)); + Module *M = new Module("MyModule", Ctx); Type *ArgTy1[] = {Type::getInt32PtrTy(Ctx)}; FunctionType *FT = FunctionType::get(Type::getVoidTy(Ctx), ArgTy1, false); - auto *V = new Argument(Type::getInt32Ty(Ctx)); - Function *F = Function::Create(FT, Function::ExternalLinkage, "", M.get()); + Argument *V = new Argument(Type::getInt32Ty(Ctx)); + Function *F = Function::Create(FT, Function::ExternalLinkage, "", M); - Value *DbgAddr = Intrinsic::getDeclaration(M.get(), Intrinsic::dbg_addr); + Value *DbgAddr = Intrinsic::getDeclaration(M, Intrinsic::dbg_addr); Value *DbgDeclare = - Intrinsic::getDeclaration(M.get(), Intrinsic::dbg_declare); - Value *DbgValue = Intrinsic::getDeclaration(M.get(), Intrinsic::dbg_value); + Intrinsic::getDeclaration(M, Intrinsic::dbg_declare); + Value *DbgValue = Intrinsic::getDeclaration(M, Intrinsic::dbg_value); Value *DIV = MetadataAsValue::get(Ctx, (Metadata *)nullptr); SmallVector<Value *, 3> Args = {DIV, DIV, DIV}; @@ -114,6 +114,9 @@ TEST(BasicBlockTest, TestSkipInsts) { SmallVector<Instruction *, 4> Exp = {Var, AddInst, MulInst, SubInst}; CHECK_ITERATORS(BB1->instructionsWithoutDebug(), Exp); CHECK_ITERATORS(BBConst->instructionsWithoutDebug(), Exp); + + delete M; + delete V; } } // End anonymous namespace. |