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 | e5b089ad374a0f5a0012332c03eb69af41354325 (patch) | |
tree | a8a7833d4967ae07d9a86c0783c78d2b45eab127 /unittests | |
parent | 11aa97103c9a5dccc69ff456d81b534aff7ce6f0 (diff) | |
download | external_llvm-e5b089ad374a0f5a0012332c03eb69af41354325.zip external_llvm-e5b089ad374a0f5a0012332c03eb69af41354325.tar.gz external_llvm-e5b089ad374a0f5a0012332c03eb69af41354325.tar.bz2 |
Catch more cases of a pointer being marked garbage twice. This helps when
debugging some leaks (PR5770 in particular).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91713 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Support/LeakDetectorTest.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/unittests/Support/LeakDetectorTest.cpp b/unittests/Support/LeakDetectorTest.cpp new file mode 100644 index 0000000..85ef046 --- /dev/null +++ b/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 + +} |