//===----------------------------------------------------------------------===//
MethodType::MethodType(const Type *Result, const vector<const Type*> &Params,
- bool IsVarArgs) : DerivedType("", MethodTyID),
+ bool IsVarArgs) : DerivedType(MethodTyID),
ResultType(PATypeHandle<Type>(Result, this)),
isVarArgs(IsVarArgs) {
ParamTys.reserve(Params.size());
setDerivedTypeProperties();
}
-ArrayType::ArrayType(const Type *ElType, int NumEl)
- : CompositeType("", ArrayTyID), ElementType(PATypeHandle<Type>(ElType, this)){
- NumElements = NumEl;
- setDerivedTypeProperties();
-}
-
StructType::StructType(const vector<const Type*> &Types)
- : CompositeType("", StructTyID) {
+ : CompositeType(StructTyID) {
ETypes.reserve(Types.size());
for (unsigned i = 0; i < Types.size(); ++i) {
assert(Types[i] != Type::VoidTy && "Void type in method prototype!!");
setDerivedTypeProperties();
}
-PointerType::PointerType(const Type *E) : DerivedType("", PointerTyID),
- ValueType(PATypeHandle<Type>(E, this)) {
+ArrayType::ArrayType(const Type *ElType, unsigned NumEl)
+ : SequentialType(ArrayTyID, ElType) {
+ NumElements = NumEl;
setDerivedTypeProperties();
}
-OpaqueType::OpaqueType() : DerivedType("", OpaqueTyID) {
+PointerType::PointerType(const Type *E) : SequentialType(PointerTyID, E) {
+ setDerivedTypeProperties();
+}
+
+OpaqueType::OpaqueType() : DerivedType(OpaqueTyID) {
setAbstract(true);
setDescription("opaque"+utostr(getUniqueID()));
#ifdef DEBUG_MERGE_TYPES
}
case Type::ArrayTyID: {
const ArrayType *ATy = cast<const ArrayType>(Ty);
- int NumElements = ATy->getNumElements();
+ unsigned NumElements = ATy->getNumElements();
Result = "[";
- if (NumElements != -1) Result += itostr(NumElements) + " x ";
+ Result += utostr(NumElements) + " x ";
Result += getTypeProps(ATy->getElementType(), TypeStack,
isAbstract, isRecursive) + "]";
break;
//
class ArrayValType : public ValTypeBase<ArrayValType, ArrayType> {
PATypeHandle<Type> ValTy;
- int Size;
+ unsigned Size;
public:
ArrayValType(const Type *val, int sz, TypeMap<ArrayValType, ArrayType> &Tab)
: ValTypeBase<ArrayValType, ArrayType>(Tab), ValTy(val, this), Size(sz) {}
static TypeMap<ArrayValType, ArrayType> ArrayTypes;
-ArrayType *ArrayType::get(const Type *ElementType, int NumElements = -1) {
+ArrayType *ArrayType::get(const Type *ElementType, unsigned NumElements) {
assert(ElementType && "Can't get array of null types!");
ArrayValType AVT(ElementType, NumElements, ArrayTypes);
#endif
if (!OldType->isAbstract()) {
- assert(ElementType == OldType);
+ assert(getElementType() == OldType);
ElementType.removeUserFromConcrete();
}
#endif
if (!OldType->isAbstract()) {
- assert(ValueType == OldType);
- ValueType.removeUserFromConcrete();
+ assert(ElementType == OldType);
+ ElementType.removeUserFromConcrete();
}
- ValueType = NewType;
+ ElementType = NewType;
const PointerType *PT = PointerTypes.containsEquivalent(this);
if (PT && PT != this) {