diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2013-01-23 08:30:26 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2013-01-23 08:30:26 +0000 |
commit | 6bf3e46aa87d0cb6044f2282a40411211bf95a5d (patch) | |
tree | ba7a9ea3ff440f1e20b5e74f92597153e3c6076b /unittests | |
parent | bde0f0f225c8504bec62e9e3c39f1d4573c0ee77 (diff) |
IRTests/ConstantsTest.cpp: AsInstructionsTest: Delete each instruction immediately if it is not linked.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173236 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/IR/ConstantsTest.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/unittests/IR/ConstantsTest.cpp b/unittests/IR/ConstantsTest.cpp index db783f72d46..5c739cd2177 100644 --- a/unittests/IR/ConstantsTest.cpp +++ b/unittests/IR/ConstantsTest.cpp @@ -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) { |