IRTests/ConstantsTest.cpp: AsInstructionsTest: Delete each instruction immediately...
authorNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 23 Jan 2013 08:30:26 +0000 (08:30 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 23 Jan 2013 08:30:26 +0000 (08:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173236 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/IR/ConstantsTest.cpp

index db783f72d46760f8b3e2d3cdf40e511780fb847c..5c739cd2177a06b4baf287289158e2657287d477 100644 (file)
@@ -151,12 +151,14 @@ TEST(ConstantsTest, PointerCast) {
               Constant::getNullValue(Int8PtrVecTy), Int32PtrVecTy));
 }
 
-#define CHECK(x, y) {                                           \
-    std::string __s;                                            \
-    raw_string_ostream __o(__s);                                \
-    cast<ConstantExpr>(x)->getAsInstruction()->print(__o);      \
-    __o.flush();                                                \
-    EXPECT_EQ(std::string("  <badref> = " y), __s);             \
+#define CHECK(x, y) {                                                  \
+    std::string __s;                                                   \
+    raw_string_ostream __o(__s);                                       \
+    Instruction *__I = cast<ConstantExpr>(x)->getAsInstruction();      \
+    __I->print(__o);                                                   \
+    delete __I;                                                        \
+    __o.flush();                                                       \
+    EXPECT_EQ(std::string("  <badref> = " y), __s);                    \
   }
 
 TEST(ConstantsTest, AsInstructionsTest) {