summaryrefslogtreecommitdiff
path: root/lib/VMCore/LLVMContextImpl.h
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-08-13 23:27:32 +0000
committerOwen Anderson <resistor@mac.com>2009-08-13 23:27:32 +0000
commit0e275dc53880a7f14f8b8c83cc6e0290a215492d (patch)
tree08ea0f696cb049a03061301387fce33e4ee18226 /lib/VMCore/LLVMContextImpl.h
parentec9b26100e06d566ccb4516c6fe3f2a685ecd941 (diff)
downloadllvm-0e275dc53880a7f14f8b8c83cc6e0290a215492d.tar.gz
llvm-0e275dc53880a7f14f8b8c83cc6e0290a215492d.tar.bz2
llvm-0e275dc53880a7f14f8b8c83cc6e0290a215492d.tar.xz
Actually privatize a IntegerTypes, and fix a few bugs exposed by this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78955 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/LLVMContextImpl.h')
-rw-r--r--lib/VMCore/LLVMContextImpl.h54
1 files changed, 53 insertions, 1 deletions
diff --git a/lib/VMCore/LLVMContextImpl.h b/lib/VMCore/LLVMContextImpl.h
index 30a7fc4af9..9c48fbe730 100644
--- a/lib/VMCore/LLVMContextImpl.h
+++ b/lib/VMCore/LLVMContextImpl.h
@@ -137,8 +137,60 @@ public:
TypeMap<PointerValType, PointerType> PointerTypes;
TypeMap<FunctionValType, FunctionType> FunctionTypes;
TypeMap<StructValType, StructType> StructTypes;
+ TypeMap<IntegerValType, IntegerType> IntegerTypes;
- LLVMContextImpl() : TheTrueVal(0), TheFalseVal(0) { }
+ const Type *VoidTy;
+ const Type *LabelTy;
+ const Type *FloatTy;
+ const Type *DoubleTy;
+ const Type *MetadataTy;
+ const Type *X86_FP80Ty;
+ const Type *FP128Ty;
+ const Type *PPC_FP128Ty;
+
+ const IntegerType *Int1Ty;
+ const IntegerType *Int8Ty;
+ const IntegerType *Int16Ty;
+ const IntegerType *Int32Ty;
+ const IntegerType *Int64Ty;
+
+ LLVMContextImpl(LLVMContext &C) : TheTrueVal(0), TheFalseVal(0),
+ VoidTy(new Type(C, Type::VoidTyID)),
+ LabelTy(new Type(C, Type::LabelTyID)),
+ FloatTy(new Type(C, Type::FloatTyID)),
+ DoubleTy(new Type(C, Type::DoubleTyID)),
+ MetadataTy(new Type(C, Type::MetadataTyID)),
+ X86_FP80Ty(new Type(C, Type::X86_FP80TyID)),
+ FP128Ty(new Type(C, Type::FP128TyID)),
+ PPC_FP128Ty(new Type(C, Type::PPC_FP128TyID)),
+ Int1Ty(new IntegerType(C, 1)),
+ Int8Ty(new IntegerType(C, 8)),
+ Int16Ty(new IntegerType(C, 16)),
+ Int32Ty(new IntegerType(C, 32)),
+ Int64Ty(new IntegerType(C, 64)) { }
+
+ ~LLVMContextImpl() {
+ // In principle, we should delete the member types here. However,
+ // this causes destruction order issues with the types in the TypeMaps.
+ // For now, just leak this, which is at least not a regression from the
+ // previous behavior, though still undesirable.
+#if 0
+ delete VoidTy;
+ delete LabelTy;
+ delete FloatTy;
+ delete DoubleTy;
+ delete MetadataTy;
+ delete X86_FP80Ty;
+ delete FP128Ty;
+ delete PPC_FP128Ty;
+
+ delete Int1Ty;
+ delete Int8Ty;
+ delete Int16Ty;
+ delete Int32Ty;
+ delete Int64Ty;
+#endif
+ }
};
}