diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2009-12-18 20:35:38 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2009-12-18 20:35:38 +0000 |
| commit | 2c5792a6bd422da6f78e9357f57f88ead8f196a6 (patch) | |
| tree | 052d1c2a8e2617296a5f8e1a6ba7698126f51551 /llvm/unittests/Support | |
| parent | 532cd232fb7f57df5a92cd2699429b2d3d18896a (diff) | |
| download | bcm5719-llvm-2c5792a6bd422da6f78e9357f57f88ead8f196a6.tar.gz bcm5719-llvm-2c5792a6bd422da6f78e9357f57f88ead8f196a6.zip | |
Catch more cases of a pointer being marked garbage twice. This helps when
debugging some leaks (PR5770 in particular).
llvm-svn: 91713
Diffstat (limited to 'llvm/unittests/Support')
| -rw-r--r-- | llvm/unittests/Support/LeakDetectorTest.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/llvm/unittests/Support/LeakDetectorTest.cpp b/llvm/unittests/Support/LeakDetectorTest.cpp new file mode 100644 index 00000000000..85ef04676dc --- /dev/null +++ b/llvm/unittests/Support/LeakDetectorTest.cpp @@ -0,0 +1,29 @@ +//===- llvm/unittest/LeakDetector/LeakDetector.cpp - LeakDetector tests ---===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "gtest/gtest.h" +#include "llvm/Support/LeakDetector.h" + +using namespace llvm; + +namespace { + +#ifdef GTEST_HAS_DEATH_TEST +TEST(LeakDetector, Death1) { + LeakDetector::addGarbageObject((void*) 1); + LeakDetector::addGarbageObject((void*) 2); + + EXPECT_DEATH(LeakDetector::addGarbageObject((void*) 1), + ".*Ts.count\\(o\\) == 0 && \"Object already in set!\""); + EXPECT_DEATH(LeakDetector::addGarbageObject((void*) 2), + "Cache != o && \"Object already in set!\""); +} +#endif + +} |

