From 8f124fe88409b444fc3139b38423e3a61d4095dd Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Tue, 4 Mar 2014 12:46:06 +0000 Subject: [Modules] Move the LeakDetector header into the IR library where the source file had already been moved. Also move the unittest into the IR unittest library. This may seem an odd thing to put in the IR library but we only really use this with instructions and it needs the LLVM context to work, so it is intrinsically tied to the IR library. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202842 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/IR/CMakeLists.txt | 1 + unittests/IR/LeakDetectorTest.cpp | 31 +++++++++++++++++++++++++++++++ unittests/Support/CMakeLists.txt | 1 - unittests/Support/LeakDetectorTest.cpp | 31 ------------------------------- 4 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 unittests/IR/LeakDetectorTest.cpp delete mode 100644 unittests/Support/LeakDetectorTest.cpp (limited to 'unittests') diff --git a/unittests/IR/CMakeLists.txt b/unittests/IR/CMakeLists.txt index e1c295d0be..7368a24051 100644 --- a/unittests/IR/CMakeLists.txt +++ b/unittests/IR/CMakeLists.txt @@ -13,6 +13,7 @@ set(IRSources DominatorTreeTest.cpp IRBuilderTest.cpp InstructionsTest.cpp + LeakDetectorTest.cpp LegacyPassManagerTest.cpp MDBuilderTest.cpp MetadataTest.cpp diff --git a/unittests/IR/LeakDetectorTest.cpp b/unittests/IR/LeakDetectorTest.cpp new file mode 100644 index 0000000000..94eed4c143 --- /dev/null +++ b/unittests/IR/LeakDetectorTest.cpp @@ -0,0 +1,31 @@ +//===- LeakDetectorTest.cpp -----------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm/IR/LeakDetector.h" +#include "gtest/gtest.h" + +using namespace llvm; + +namespace { + +#ifdef GTEST_HAS_DEATH_TEST +#ifndef NDEBUG +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 +#endif + +} diff --git a/unittests/Support/CMakeLists.txt b/unittests/Support/CMakeLists.txt index 9df2e17277..93f707e4e2 100644 --- a/unittests/Support/CMakeLists.txt +++ b/unittests/Support/CMakeLists.txt @@ -17,7 +17,6 @@ add_llvm_unittest(SupportTests ErrorOrTest.cpp FileOutputBufferTest.cpp LEB128Test.cpp - LeakDetectorTest.cpp LineIteratorTest.cpp LockFileManagerTest.cpp ManagedStatic.cpp diff --git a/unittests/Support/LeakDetectorTest.cpp b/unittests/Support/LeakDetectorTest.cpp deleted file mode 100644 index d198c7a8bd..0000000000 --- a/unittests/Support/LeakDetectorTest.cpp +++ /dev/null @@ -1,31 +0,0 @@ -//===- 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 -#ifndef NDEBUG -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 -#endif - -} -- cgit v1.2.3