From ef76b27a19b2f27d93878b743d5247438a581a05 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 22 May 2003 21:31:52 +0000 Subject: [PATCH] Fix static constructor ordering problem llvm-svn: 6302 --- llvm/lib/VMCore/Type.cpp | 48 +++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/llvm/lib/VMCore/Type.cpp b/llvm/lib/VMCore/Type.cpp index aa3b676bf4ac..686527315fbc 100644 --- a/llvm/lib/VMCore/Type.cpp +++ b/llvm/lib/VMCore/Type.cpp @@ -166,29 +166,47 @@ struct UnsignedIntType : public Type { virtual bool isInteger() const { return 1; } }; +struct OtherType : public Type { + OtherType(const std::string &N, PrimitiveID id) : Type(N, id) {} +}; + static struct TypeType : public Type { TypeType() : Type("type", TypeTyID) {} -} TheTypeType; // Implement the type that is global. +} TheTypeTy; // Implement the type that is global. //===----------------------------------------------------------------------===// // Static 'Type' data //===----------------------------------------------------------------------===// -Type *Type::VoidTy = new Type("void" , VoidTyID), - *Type::BoolTy = new Type("bool" , BoolTyID), - *Type::SByteTy = new SignedIntType("sbyte" , SByteTyID), - *Type::UByteTy = new UnsignedIntType("ubyte" , UByteTyID), - *Type::ShortTy = new SignedIntType("short" , ShortTyID), - *Type::UShortTy = new UnsignedIntType("ushort", UShortTyID), - *Type::IntTy = new SignedIntType("int" , IntTyID), - *Type::UIntTy = new UnsignedIntType("uint" , UIntTyID), - *Type::LongTy = new SignedIntType("long" , LongTyID), - *Type::ULongTy = new UnsignedIntType("ulong" , ULongTyID), - *Type::FloatTy = new Type("float" , FloatTyID), - *Type::DoubleTy = new Type("double", DoubleTyID), - *Type::TypeTy = &TheTypeType, - *Type::LabelTy = new Type("label" , LabelTyID); +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); + +Type *Type::VoidTy = &TheVoidTy; +Type *Type::BoolTy = &TheBoolTy; +Type *Type::SByteTy = &TheSByteTy; +Type *Type::UByteTy = &TheUByteTy; +Type *Type::ShortTy = &TheShortTy; +Type *Type::UShortTy = &TheUShortTy; +Type *Type::IntTy = &TheIntTy; +Type *Type::UIntTy = &TheUIntTy; +Type *Type::LongTy = &TheLongTy; +Type *Type::ULongTy = &TheULongTy; +Type *Type::FloatTy = &TheFloatTy; +Type *Type::DoubleTy = &TheDoubleTy; +Type *Type::TypeTy = &TheTypeTy; +Type *Type::LabelTy = &TheLabelTy; //===----------------------------------------------------------------------===//