summaryrefslogtreecommitdiff
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-05-22 21:31:52 +0000
committerChris Lattner <sabre@nondot.org>2003-05-22 21:31:52 +0000
commit950273b3e750d40d8bc7a7971902829615e3ce24 (patch)
tree2320ab0823663609c251592ce6777ea7d2211f27 /lib/VMCore
parentc2312df45cd10b580c500e1fc8f93b9693d73fe4 (diff)
downloadllvm-950273b3e750d40d8bc7a7971902829615e3ce24.tar.gz
llvm-950273b3e750d40d8bc7a7971902829615e3ce24.tar.bz2
llvm-950273b3e750d40d8bc7a7971902829615e3ce24.tar.xz
Fix static constructor ordering problem
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6302 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Type.cpp48
1 files changed, 33 insertions, 15 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index aa3b676bf4..686527315f 100644
--- a/lib/VMCore/Type.cpp
+++ b/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;
//===----------------------------------------------------------------------===//