// isSigned - Return whether a numeric type is signed.
virtual bool isSigned() const { return 1; }
+
+ // isIntegral - Return whether this is one of the integer types
+ virtual bool isIntegral() const { return 1; }
};
class UnsignedIntType : public Type {
// isUnsigned - Return whether a numeric type is signed.
virtual bool isUnsigned() const { return 1; }
+
+ // isIntegral - Return whether this is one of the integer types
+ virtual bool isIntegral() const { return 1; }
};
static struct TypeType : public Type {
}
StructType::StructType(const vector<const Type*> &Types, const string &Name)
- : Type(Name, StructTyID), ETypes(Types) {
+ : Type(Name, StructTyID),
+ ETypes(Types),
+ layoutCache(new StructSizeAndOffsetInfo)
+{
+ ResetCachedInfo();
}
PointerType::PointerType(const Type *E)
const MethodType *MethodType::getMethodType(const Type *ReturnType,
const vector<const Type*> &Params) {
static vector<const MethodType*> ExistingMethodTypesCache;
- for (unsigned i = 0; i < ExistingMethodTypesCache.size(); i++) {
+ for (unsigned i = 0; i < ExistingMethodTypesCache.size(); ++i) {
const MethodType *T = ExistingMethodTypesCache[i];
if (T->getReturnType() == ReturnType) {
const ParamTypes &EParams = T->getParamTypes();
ParamTypes::const_iterator I = Params.begin();
ParamTypes::const_iterator J = EParams.begin();
- for (; I != Params.end() && J != EParams.end(); I++, J++)
+ for (; I != Params.end() && J != EParams.end(); ++I, ++J)
if (*I != *J) break; // These types aren't equal!
if (I == Params.end() && J == EParams.end()) {
// Calculate the string name for the new type...
string Name = ReturnType->getName() + " (";
for (ParamTypes::const_iterator I = Params.begin();
- I != Params.end(); I++) {
+ I != Params.end(); ++I) {
if (I != Params.begin())
Name += ", ";
Name += (*I)->getName();
const ArrayType *ArrayType::getArrayType(const Type *ElementType,
int NumElements = -1) {
+ assert(ElementType && "Can't get array of null types!");
static vector<const ArrayType*> ExistingTypesCache;
// Search cache for value...
- for (unsigned i = 0; i < ExistingTypesCache.size(); i++) {
+ for (unsigned i = 0; i < ExistingTypesCache.size(); ++i) {
const ArrayType *T = ExistingTypesCache[i];
if (T->getElementType() == ElementType &&
const StructType *StructType::getStructType(const ElementTypes &ETypes) {
static vector<const StructType*> ExistingStructTypesCache;
- for (unsigned i = 0; i < ExistingStructTypesCache.size(); i++) {
+ for (unsigned i = 0; i < ExistingStructTypesCache.size(); ++i) {
const StructType *T = ExistingStructTypesCache[i];
const ElementTypes &Elements = T->getElementTypes();
ElementTypes::const_iterator I = ETypes.begin();
ElementTypes::const_iterator J = Elements.begin();
- for (; I != ETypes.end() && J != Elements.end(); I++, J++)
+ for (; I != ETypes.end() && J != Elements.end(); ++I, ++J)
if (*I != *J) break; // These types aren't equal!
if (I == ETypes.end() && J == Elements.end()) {
// Calculate the string name for the new type...
string Name = "{ ";
for (ElementTypes::const_iterator I = ETypes.begin();
- I != ETypes.end(); I++) {
+ I != ETypes.end(); ++I) {
if (I != ETypes.begin())
Name += ", ";
Name += (*I)->getName();
const PointerType *PointerType::getPointerType(const Type *ValueType) {
+ assert(ValueType && "Can't get a pointer to <null> type!");
static vector<const PointerType*> ExistingTypesCache;
// Search cache for value...
- for (unsigned i = 0; i < ExistingTypesCache.size(); i++) {
+ for (unsigned i = 0; i < ExistingTypesCache.size(); ++i) {
const PointerType *T = ExistingTypesCache[i];
if (T->getValueType() == ValueType)