X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=unittests%2FIR%2FConstantsTest.cpp;h=b3aa8102b64d36b3de85cbd2e308b5afd6d69620;hb=15903b7dc5cc31c529010b659eab326fd7565671;hp=db783f72d46760f8b3e2d3cdf40e511780fb847c;hpb=655578f8b5275e7c59b87d4709b0d56b2621caac;p=oota-llvm.git diff --git a/unittests/IR/ConstantsTest.cpp b/unittests/IR/ConstantsTest.cpp index db783f72d46..b3aa8102b64 100644 --- a/unittests/IR/ConstantsTest.cpp +++ b/unittests/IR/ConstantsTest.cpp @@ -151,16 +151,18 @@ TEST(ConstantsTest, PointerCast) { Constant::getNullValue(Int8PtrVecTy), Int32PtrVecTy)); } -#define CHECK(x, y) { \ - std::string __s; \ - raw_string_ostream __o(__s); \ - cast(x)->getAsInstruction()->print(__o); \ - __o.flush(); \ - EXPECT_EQ(std::string(" = " y), __s); \ +#define CHECK(x, y) { \ + std::string __s; \ + raw_string_ostream __o(__s); \ + Instruction *__I = cast(x)->getAsInstruction(); \ + __I->print(__o); \ + delete __I; \ + __o.flush(); \ + EXPECT_EQ(std::string(" = " y), __s); \ } TEST(ConstantsTest, AsInstructionsTest) { - Module *M = new Module("MyModule", getGlobalContext()); + std::unique_ptr M(new Module("MyModule", getGlobalContext())); Type *Int64Ty = Type::getInt64Ty(getGlobalContext()); Type *Int32Ty = Type::getInt32Ty(getGlobalContext());