[llvm-commits] [llvm] r95677 - in /llvm/trunk: include/llvm/Support/TypeBuilder.h unittests/Support/TypeBuilderTest.cpp

Jeffrey Yasskin jyasskin at google.com
Tue Feb 9 11:07:19 PST 2010


Author: jyasskin
Date: Tue Feb  9 13:07:19 2010
New Revision: 95677

URL: http://llvm.org/viewvc/llvm-project?rev=95677&view=rev
Log:
Add support for TypeBuilder<const/volatile void*, false>.
Thanks to Jochen Wilhelmy for the suggestion!


Modified:
    llvm/trunk/include/llvm/Support/TypeBuilder.h
    llvm/trunk/unittests/Support/TypeBuilderTest.cpp

Modified: llvm/trunk/include/llvm/Support/TypeBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TypeBuilder.h?rev=95677&r1=95676&r2=95677&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/TypeBuilder.h (original)
+++ llvm/trunk/include/llvm/Support/TypeBuilder.h Tue Feb  9 13:07:19 2010
@@ -231,6 +231,12 @@
 /// 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:

Modified: llvm/trunk/unittests/Support/TypeBuilderTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/TypeBuilderTest.cpp?rev=95677&r1=95676&r2=95677&view=diff

==============================================================================
--- llvm/trunk/unittests/Support/TypeBuilderTest.cpp (original)
+++ llvm/trunk/unittests/Support/TypeBuilderTest.cpp Tue Feb  9 13:07:19 2010
@@ -19,9 +19,16 @@
 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) {





More information about the llvm-commits mailing list