diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2009-12-17 19:55:06 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2009-12-17 19:55:06 +0000 |
commit | ad715f86c90b06cc4ab9e1336d1bc3bf13ecb16d (patch) | |
tree | 4a10bbf7f6939ab35b86d00d5b25e54d669aabf4 /unittests/VMCore | |
parent | af15ffb9127dff185b74ff8b37a9d570ca547c61 (diff) |
This fixes a memory leak in OpaqueType found by Google's internal heapchecker.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91611 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/VMCore')
-rw-r--r-- | unittests/VMCore/DerivedTypesTest.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/unittests/VMCore/DerivedTypesTest.cpp b/unittests/VMCore/DerivedTypesTest.cpp new file mode 100644 index 0000000000..11b4dffb5f --- /dev/null +++ b/unittests/VMCore/DerivedTypesTest.cpp @@ -0,0 +1,31 @@ +//===- llvm/unittest/VMCore/DerivedTypesTest.cpp - Types unit 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 "../lib/VMCore/LLVMContextImpl.h" +#include "llvm/Type.h" +#include "llvm/DerivedTypes.h" +#include "llvm/LLVMContext.h" +using namespace llvm; + +namespace { + +TEST(OpaqueTypeTest, RegisterWithContext) { + LLVMContext C; + LLVMContextImpl *pImpl = C.pImpl; + + EXPECT_EQ(0u, pImpl->OpaqueTypes.size()); + { + PATypeHolder Type = OpaqueType::get(C); + EXPECT_EQ(1u, pImpl->OpaqueTypes.size()); + } + EXPECT_EQ(0u, pImpl->OpaqueTypes.size()); +} + +} // namespace |