Add support for TypeBuilder<const/volatile void*, false>.

Thanks to Jochen Wilhelmy for the suggestion!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95677 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jeffrey Yasskin 2010-02-09 19:07:19 +00:00
parent d2592ff69b
commit 5e24737d16
2 changed files with 14 additions and 1 deletions

View File

@ -231,6 +231,12 @@ public:
/// we special case it. /// we special case it.
template<> class TypeBuilder<void*, false> template<> class TypeBuilder<void*, false>
: public TypeBuilder<types::i<8>*, 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> { template<typename R, bool cross> class TypeBuilder<R(), cross> {
public: public:

View File

@ -19,9 +19,16 @@ namespace {
TEST(TypeBuilderTest, Void) { TEST(TypeBuilderTest, Void) {
EXPECT_EQ(Type::getVoidTy(getGlobalContext()), (TypeBuilder<void, true>::get(getGlobalContext()))); EXPECT_EQ(Type::getVoidTy(getGlobalContext()), (TypeBuilder<void, true>::get(getGlobalContext())));
EXPECT_EQ(Type::getVoidTy(getGlobalContext()), (TypeBuilder<void, false>::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()), EXPECT_EQ(Type::getInt8PtrTy(getGlobalContext()),
(TypeBuilder<void*, false>::get(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) { TEST(TypeBuilderTest, HostIntegers) {