summaryrefslogtreecommitdiff
path: root/unittests/VMCore/DerivedTypesTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/VMCore/DerivedTypesTest.cpp')
-rw-r--r--unittests/VMCore/DerivedTypesTest.cpp31
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