AbstractTypeUser::~AbstractTypeUser() {}
-//===----------------------------------------------------------------------===//
-// Type PATypeHolder Implementation
-//===----------------------------------------------------------------------===//
-
-/// get - This implements the forwarding part of the union-find algorithm for
-/// abstract types. Before every access to the Type*, we check to see if the
-/// type we are pointing to is forwarding to a new type. If so, we drop our
-/// reference to the type.
-///
-Type* PATypeHolder::get() const {
- const Type *NewTy = Ty->getForwardedType();
- if (!NewTy) return const_cast<Type*>(Ty);
- return *const_cast<PATypeHolder*>(this) = NewTy;
-}
-
//===----------------------------------------------------------------------===//
// Type Class Implementation
//===----------------------------------------------------------------------===//
// Now call the destructor for the subclass directly because we're going
// to delete this as an array of char.
if (isa<FunctionType>(this))
- ((FunctionType*)this)->FunctionType::~FunctionType();
+ static_cast<const FunctionType*>(this)->FunctionType::~FunctionType();
else
- ((StructType*)this)->StructType::~StructType();
+ static_cast<const StructType*>(this)->StructType::~StructType();
// Finally, remove the memory as an array deallocation of the chars it was
// constructed from.
- delete [] reinterpret_cast<const char*>(this);
+ operator delete(const_cast<Type *>(this));
return;
}
std::vector<const Type *> &TypeStack) {
if (isa<OpaqueType>(Ty)) { // Base case for the recursion
std::map<const Type*, std::string>::iterator I =
- AbstractTypeDescriptions->lower_bound(Ty);
- if (I != AbstractTypeDescriptions->end() && I->first == Ty)
+ AbstractTypeDescriptions->find(Ty);
+ if (I != AbstractTypeDescriptions->end())
return I->second;
std::string Desc = "opaque";
AbstractTypeDescriptions->insert(std::make_pair(Ty, Desc));
namespace {
struct BuiltinIntegerType : public IntegerType {
- BuiltinIntegerType(unsigned W) : IntegerType(W) {}
+ explicit BuiltinIntegerType(unsigned W) : IntegerType(W) {}
};
}
const IntegerType *Type::Int1Ty = new BuiltinIntegerType(1);
if (isa<OpaqueType>(Ty))
return false; // Two unequal opaque types are never equal
- std::map<const Type*, const Type*>::iterator It = EqTypes.lower_bound(Ty);
- if (It != EqTypes.end() && It->first == Ty)
+ std::map<const Type*, const Type*>::iterator It = EqTypes.find(Ty);
+ if (It != EqTypes.end())
return It->second == Ty2; // Looping back on a type, check for equality
// Otherwise, add the mapping to the table to make sure we don't get
if (FT)
return FT;
- FT = (FunctionType*) new char[sizeof(FunctionType) +
- sizeof(PATypeHandle)*(Params.size()+1)];
+ FT = (FunctionType*) operator new(sizeof(FunctionType) +
+ sizeof(PATypeHandle)*(Params.size()+1));
new (FT) FunctionType(ReturnType, Params, isVarArg);
FunctionTypes->add(VT, FT);
if (ST) return ST;
// Value not found. Derive a new type!
- ST = (StructType*) new char[sizeof(StructType) +
- sizeof(PATypeHandle) * ETypes.size()];
+ ST = (StructType*) operator new(sizeof(StructType) +
+ sizeof(PATypeHandle) * ETypes.size());
new (ST) StructType(ETypes, isPacked);
StructTypes->add(STV, ST);