X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;ds=sidebyside;f=unittests%2FIR%2FWaymarkTest.cpp;h=a8924efed3f5fc72e0595deab247fc6d4359c5a6;hb=629180472c0c66f4c44ef9bf06949e79331cd031;hp=dd91704d137e16db0aef07e34cafcf41089e3045;hpb=bde0f0f225c8504bec62e9e3c39f1d4573c0ee77;p=oota-llvm.git diff --git a/unittests/IR/WaymarkTest.cpp b/unittests/IR/WaymarkTest.cpp index dd91704d137..a8924efed3f 100644 --- a/unittests/IR/WaymarkTest.cpp +++ b/unittests/IR/WaymarkTest.cpp @@ -9,6 +9,7 @@ // we perform white-box tests // +#include "llvm/IR/Constants.h" #include "llvm/IR/Function.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/LLVMContext.h" @@ -28,9 +29,10 @@ TEST(WaymarkTest, NativeArray) { Value * values[22]; std::transform(tail, tail + 22, values, char2constant); FunctionType *FT = FunctionType::get(Type::getVoidTy(getGlobalContext()), true); - Function *F = Function::Create(FT, GlobalValue::ExternalLinkage); - const CallInst *A = CallInst::Create(F, makeArrayRef(values)); - ASSERT_NE(A, (const CallInst*)NULL); + std::unique_ptr F( + Function::Create(FT, GlobalValue::ExternalLinkage)); + const CallInst *A = CallInst::Create(F.get(), makeArrayRef(values)); + ASSERT_NE(A, (const CallInst*)nullptr); ASSERT_EQ(1U + 22, A->getNumOperands()); const Use *U = &A->getOperandUse(0); const Use *Ue = &A->getOperandUse(22); @@ -38,6 +40,7 @@ TEST(WaymarkTest, NativeArray) { { EXPECT_EQ(A, U->getUser()); } + delete A; } TEST(WaymarkTest, TwoBit) { @@ -48,6 +51,7 @@ TEST(WaymarkTest, TwoBit) { { EXPECT_EQ(reinterpret_cast(Ue + 1), U->getUser()); } + free(many); } } // end anonymous namespace