Add support for TypeBuilder<const/volatile void*, false>.
authorJeffrey Yasskin <jyasskin@google.com>
Tue, 9 Feb 2010 19:07:19 +0000 (19:07 +0000)
committerJeffrey Yasskin <jyasskin@google.com>
Tue, 9 Feb 2010 19:07:19 +0000 (19:07 +0000)
Thanks to Jochen Wilhelmy for the suggestion!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95677 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/TypeBuilder.h
unittests/Support/TypeBuilderTest.cpp

index fb22e3f5241d53110d53ecf7233430426e416f92..270ac529c7e7a3f9d6ebb40d049893327fbc6e43 100644 (file)
@@ -231,6 +231,12 @@ public:
 /// we special case it.
 template<> class TypeBuilder<void*, false>
   : public TypeBuilder<types::i<8>*, false> {};
+template<> class TypeBuilder<const void*, false>
+  : public TypeBuilder<types::i<8>*, false> {};
+template<> class TypeBuilder<volatile void*, false>
+  : public TypeBuilder<types::i<8>*, false> {};
+template<> class TypeBuilder<const volatile void*, false>
+  : public TypeBuilder<types::i<8>*, false> {};
 
 template<typename R, bool cross> class TypeBuilder<R(), cross> {
 public:
index a5c5e67129a343ecf25837b949b93827b25deb5d..e805827ae224fe1f5746a2fd9f7f9a80e8703efc 100644 (file)
@@ -19,9 +19,16 @@ namespace {
 TEST(TypeBuilderTest, Void) {
   EXPECT_EQ(Type::getVoidTy(getGlobalContext()), (TypeBuilder<void, true>::get(getGlobalContext())));
   EXPECT_EQ(Type::getVoidTy(getGlobalContext()), (TypeBuilder<void, false>::get(getGlobalContext())));
-  // Special case for C compatibility:
+  // Special cases for C compatibility:
   EXPECT_EQ(Type::getInt8PtrTy(getGlobalContext()),
             (TypeBuilder<void*, false>::get(getGlobalContext())));
+  EXPECT_EQ(Type::getInt8PtrTy(getGlobalContext()),
+            (TypeBuilder<const void*, false>::get(getGlobalContext())));
+  EXPECT_EQ(Type::getInt8PtrTy(getGlobalContext()),
+            (TypeBuilder<volatile void*, false>::get(getGlobalContext())));
+  EXPECT_EQ(Type::getInt8PtrTy(getGlobalContext()),
+            (TypeBuilder<const volatile void*, false>::get(
+              getGlobalContext())));
 }
 
 TEST(TypeBuilderTest, HostIntegers) {