aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2010-02-09 19:07:19 +0000
committerJeffrey Yasskin <jyasskin@google.com>2010-02-09 19:07:19 +0000
commit5e24737d16e1c2aab65d24ff2a10ffc5255864f9 (patch)
tree5d797439bc2b475687ab6d40a1056adc04ffcedb
parentd2592ff69ba86d8d5da5b598429f373cb2842699 (diff)
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
-rw-r--r--include/llvm/Support/TypeBuilder.h6
-rw-r--r--unittests/Support/TypeBuilderTest.cpp9
2 files changed, 14 insertions, 1 deletions
diff --git a/include/llvm/Support/TypeBuilder.h b/include/llvm/Support/TypeBuilder.h
index fb22e3f524..270ac529c7 100644
--- a/include/llvm/Support/TypeBuilder.h
+++ b/include/llvm/Support/TypeBuilder.h
@@ -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:
diff --git a/unittests/Support/TypeBuilderTest.cpp b/unittests/Support/TypeBuilderTest.cpp
index a5c5e67129..e805827ae2 100644
--- a/unittests/Support/TypeBuilderTest.cpp
+++ b/unittests/Support/TypeBuilderTest.cpp
@@ -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) {