aboutsummaryrefslogtreecommitdiff
path: root/unittests/Support/TypeBuilderTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Support/TypeBuilderTest.cpp')
-rw-r--r--unittests/Support/TypeBuilderTest.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/unittests/Support/TypeBuilderTest.cpp b/unittests/Support/TypeBuilderTest.cpp
index bd9f5d64a2..fae8907cda 100644
--- a/unittests/Support/TypeBuilderTest.cpp
+++ b/unittests/Support/TypeBuilderTest.cpp
@@ -147,6 +147,18 @@ TEST(TypeBuilderTest, Functions) {
false>::get(getGlobalContext())));
}
+TEST(TypeBuilderTest, Context) {
+ // We used to cache TypeBuilder results in static local variables. This
+ // produced the same type for different contexts, which of course broke
+ // things.
+ LLVMContext context1;
+ EXPECT_EQ(&context1,
+ &(TypeBuilder<types::i<1>, true>::get(context1))->getContext());
+ LLVMContext context2;
+ EXPECT_EQ(&context2,
+ &(TypeBuilder<types::i<1>, true>::get(context2))->getContext());
+}
+
class MyType {
int a;
int *b;