aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
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 /include/llvm
parentec9b26100e06d566ccb4516c6fe3f2a685ecd941 (diff)
downloadexternal_llvm-0e275dc53880a7f14f8b8c83cc6e0290a215492d.zip
external_llvm-0e275dc53880a7f14f8b8c83cc6e0290a215492d.tar.gz
external_llvm-0e275dc53880a7f14f8b8c83cc6e0290a215492d.tar.bz2
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 'include/llvm')
-rw-r--r--include/llvm/DerivedTypes.h21
-rw-r--r--include/llvm/Type.h6
2 files changed, 17 insertions, 10 deletions
diff --git a/include/llvm/DerivedTypes.h b/include/llvm/DerivedTypes.h
index a8603ac..fb51430 100644
--- a/include/llvm/DerivedTypes.h
+++ b/include/llvm/DerivedTypes.h
@@ -37,7 +37,7 @@ class DerivedType : public Type {
friend class Type;
protected:
- explicit DerivedType(TypeID id) : Type(id) {}
+ explicit DerivedType(LLVMContext &C, TypeID id) : Type(C, id) {}
/// notifyUsesThatTypeBecameConcrete - Notify AbstractTypeUsers of this type
/// that the current type has transitioned from being abstract to being
@@ -83,8 +83,11 @@ public:
/// Int64Ty.
/// @brief Integer representation type
class IntegerType : public DerivedType {
+ friend class LLVMContextImpl;
+
protected:
- explicit IntegerType(unsigned NumBits) : DerivedType(IntegerTyID) {
+ explicit IntegerType(LLVMContext &C, unsigned NumBits) :
+ DerivedType(C, IntegerTyID) {
setSubclassData(NumBits);
}
friend class TypeMap<IntegerValType, IntegerType>;
@@ -208,7 +211,8 @@ public:
/// and VectorType
class CompositeType : public DerivedType {
protected:
- inline explicit CompositeType(TypeID id) : DerivedType(id) { }
+ inline explicit CompositeType(LLVMContext &C, TypeID id) :
+ DerivedType(C, id) { }
public:
/// getTypeAtIndex - Given an index value into the type, return the type of
@@ -236,7 +240,8 @@ class StructType : public CompositeType {
friend class TypeMap<StructValType, StructType>;
StructType(const StructType &); // Do not implement
const StructType &operator=(const StructType &); // Do not implement
- StructType(const std::vector<const Type*> &Types, bool isPacked);
+ StructType(LLVMContext &C,
+ const std::vector<const Type*> &Types, bool isPacked);
public:
/// StructType::get - This static method is the primary way to create a
/// StructType.
@@ -313,7 +318,7 @@ class SequentialType : public CompositeType {
SequentialType* this_() { return this; }
protected:
SequentialType(TypeID TID, const Type *ElType)
- : CompositeType(TID), ContainedType(ElType, this_()) {
+ : CompositeType(ElType->getContext(), TID), ContainedType(ElType, this_()) {
ContainedTys = &ContainedType;
NumContainedTys = 1;
}
@@ -493,12 +498,12 @@ public:
class OpaqueType : public DerivedType {
OpaqueType(const OpaqueType &); // DO NOT IMPLEMENT
const OpaqueType &operator=(const OpaqueType &); // DO NOT IMPLEMENT
- OpaqueType();
+ OpaqueType(LLVMContext &C);
public:
/// OpaqueType::get - Static factory method for the OpaqueType class...
///
- static OpaqueType *get() {
- return new OpaqueType(); // All opaque types are distinct
+ static OpaqueType *get(LLVMContext &C) {
+ return new OpaqueType(C); // All opaque types are distinct
}
// Implement support for type inquiry through isa, cast, and dyn_cast:
diff --git a/include/llvm/Type.h b/include/llvm/Type.h
index 05a4e26..b751632 100644
--- a/include/llvm/Type.h
+++ b/include/llvm/Type.h
@@ -109,6 +109,7 @@ private:
/// Context - This refers to the LLVMContext in which this type was uniqued.
LLVMContext &Context;
+ friend class LLVMContextImpl;
const Type *getForwardedTypeInternal() const;
@@ -117,8 +118,9 @@ private:
void destroy() const; // const is a lie, this does "delete this"!
protected:
- explicit Type(TypeID id) : ID(id), Abstract(false), SubclassData(0),
- RefCount(0), Context(getGlobalContext()),
+ explicit Type(LLVMContext &C, TypeID id) :
+ ID(id), Abstract(false), SubclassData(0),
+ RefCount(0), Context(C),
ForwardType(0), NumContainedTys(0),
ContainedTys(0) {}
virtual ~Type() {