diff options
author | Chris Lattner <sabre@nondot.org> | 2004-07-08 17:30:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-07-08 17:30:07 +0000 |
commit | e14d7e4f9f21f86a78bb720f88e8db79099dfeff (patch) | |
tree | b93785b9de9d426a2fa7637c16dcbc7d9eb8236e | |
parent | e1d6799661f9b7fe7f5729005f9ff4afb9df9592 (diff) | |
download | external_llvm-e14d7e4f9f21f86a78bb720f88e8db79099dfeff.tar.gz external_llvm-e14d7e4f9f21f86a78bb720f88e8db79099dfeff.tar.bz2 external_llvm-e14d7e4f9f21f86a78bb720f88e8db79099dfeff.zip |
Eliminate the SignedType and UnsignedType classes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14695 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/Type.cpp | 68 |
1 files changed, 19 insertions, 49 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 026ba1bb6a..b90f47ec4d 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -326,58 +326,28 @@ const Type *StructType::getTypeAtIndex(const Value *V) const { //===----------------------------------------------------------------------===// -// Auxiliary classes -//===----------------------------------------------------------------------===// -// -// These classes are used to implement specialized behavior for each different -// type. -// -struct SignedIntType : public Type { - SignedIntType(std::string name, TypeID id) : Type(name, id) {} - - // isSigned - Return whether a numeric type is signed. - virtual bool isSigned() const { return 1; } - - // isInteger - Equivalent to isSigned() || isUnsigned, but with only a single - // virtual function invocation. - // - virtual bool isInteger() const { return 1; } -}; - -struct UnsignedIntType : public Type { - UnsignedIntType(std::string name, TypeID id) : Type(name,id) {} - - // isUnsigned - Return whether a numeric type is signed. - virtual bool isUnsigned() const { return 1; } - - // isInteger - Equivalent to isSigned() || isUnsigned, but with only a single - // virtual function invocation. - // - virtual bool isInteger() const { return 1; } -}; - -struct OtherType : public Type { - OtherType(std::string name, TypeID id) : Type(name,id) {} -}; - - -//===----------------------------------------------------------------------===// // Static 'Type' data //===----------------------------------------------------------------------===// -static OtherType TheVoidTy ("void" , Type::VoidTyID); -static OtherType TheBoolTy ("bool" , Type::BoolTyID); -static SignedIntType TheSByteTy ("sbyte" , Type::SByteTyID); -static UnsignedIntType TheUByteTy ("ubyte" , Type::UByteTyID); -static SignedIntType TheShortTy ("short" , Type::ShortTyID); -static UnsignedIntType TheUShortTy("ushort", Type::UShortTyID); -static SignedIntType TheIntTy ("int" , Type::IntTyID); -static UnsignedIntType TheUIntTy ("uint" , Type::UIntTyID); -static SignedIntType TheLongTy ("long" , Type::LongTyID); -static UnsignedIntType TheULongTy ("ulong" , Type::ULongTyID); -static OtherType TheFloatTy ("float" , Type::FloatTyID); -static OtherType TheDoubleTy("double", Type::DoubleTyID); -static OtherType TheLabelTy ("label" , Type::LabelTyID); +namespace { + struct PrimType : public Type { + PrimType(const char *S, TypeID ID) : Type(S, ID) {} + }; +} + +static PrimType TheVoidTy ("void" , Type::VoidTyID); +static PrimType TheBoolTy ("bool" , Type::BoolTyID); +static PrimType TheSByteTy ("sbyte" , Type::SByteTyID); +static PrimType TheUByteTy ("ubyte" , Type::UByteTyID); +static PrimType TheShortTy ("short" , Type::ShortTyID); +static PrimType TheUShortTy("ushort", Type::UShortTyID); +static PrimType TheIntTy ("int" , Type::IntTyID); +static PrimType TheUIntTy ("uint" , Type::UIntTyID); +static PrimType TheLongTy ("long" , Type::LongTyID); +static PrimType TheULongTy ("ulong" , Type::ULongTyID); +static PrimType TheFloatTy ("float" , Type::FloatTyID); +static PrimType TheDoubleTy("double", Type::DoubleTyID); +static PrimType TheLabelTy ("label" , Type::LabelTyID); Type *Type::VoidTy = &TheVoidTy; Type *Type::BoolTy = &TheBoolTy; |