diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-09 04:37:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-09 04:37:31 +0000 |
commit | d21cd809b656d3011ec089536857e048e037159c (patch) | |
tree | 131bf120f81f62962ffbb7520d785b63cf8d4b16 /lib/VMCore | |
parent | 037b8b70d04ce214464c89d2480811484f9ec13d (diff) | |
download | external_llvm-d21cd809b656d3011ec089536857e048e037159c.zip external_llvm-d21cd809b656d3011ec089536857e048e037159c.tar.gz external_llvm-d21cd809b656d3011ec089536857e048e037159c.tar.bz2 |
Adjust to the changed StructType interface. In particular, getElementTypes() is gone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11228 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 14 | ||||
-rw-r--r-- | lib/VMCore/Constants.cpp | 18 | ||||
-rw-r--r-- | lib/VMCore/Type.cpp | 23 |
3 files changed, 25 insertions, 30 deletions
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 3ed2312..5fc7a89 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -169,10 +169,9 @@ static std::string calcTypeName(const Type *Ty, case Type::StructTyID: { const StructType *STy = cast<StructType>(Ty); Result = "{ "; - for (StructType::ElementTypes::const_iterator - I = STy->getElementTypes().begin(), - E = STy->getElementTypes().end(); I != E; ++I) { - if (I != STy->getElementTypes().begin()) + for (StructType::element_iterator I = STy->element_begin(), + E = STy->element_end(); I != E; ++I) { + if (I != STy->element_begin()) Result += ", "; Result += calcTypeName(*I, TypeStack, TypeNames); } @@ -529,10 +528,9 @@ std::ostream &AssemblyWriter::printTypeAtLeastOneLevel(const Type *Ty) { Out << ")"; } else if (const StructType *STy = dyn_cast<StructType>(Ty)) { Out << "{ "; - for (StructType::ElementTypes::const_iterator - I = STy->getElementTypes().begin(), - E = STy->getElementTypes().end(); I != E; ++I) { - if (I != STy->getElementTypes().begin()) + for (StructType::element_iterator I = STy->element_begin(), + E = STy->element_end(); I != E; ++I) { + if (I != STy->element_begin()) Out << ", "; printType(*I); } diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index caeb8cd..2500ec4 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -118,11 +118,10 @@ Constant *Constant::getNullValue(const Type *Ty) { case Type::StructTyID: { const StructType *ST = cast<StructType>(Ty); - const StructType::ElementTypes &ETs = ST->getElementTypes(); std::vector<Constant*> Elements; - Elements.resize(ETs.size()); - for (unsigned i = 0, e = ETs.size(); i != e; ++i) - Elements[i] = Constant::getNullValue(ETs[i]); + Elements.resize(ST->getNumElements()); + for (unsigned i = 0, e = ST->getNumElements(); i != e; ++i) + Elements[i] = Constant::getNullValue(ST->getElementType(i)); return ConstantStruct::get(ST, Elements); } case Type::ArrayTyID: { @@ -263,14 +262,15 @@ ConstantArray::ConstantArray(const ArrayType *T, ConstantStruct::ConstantStruct(const StructType *T, const std::vector<Constant*> &V) : Constant(T) { - const StructType::ElementTypes &ETypes = T->getElementTypes(); - assert(V.size() == ETypes.size() && + assert(V.size() == T->getNumElements() && "Invalid initializer vector for constant structure"); Operands.reserve(V.size()); for (unsigned i = 0, e = V.size(); i != e; ++i) { - assert((V[i]->getType() == ETypes[i] || - ((ETypes[i]->isAbstract() || V[i]->getType()->isAbstract()) && - ETypes[i]->getPrimitiveID()==V[i]->getType()->getPrimitiveID())) && + assert((V[i]->getType() == T->getElementType(i) || + ((T->getElementType(i)->isAbstract() || + V[i]->getType()->isAbstract()) && + T->getElementType(i)->getPrimitiveID() == + V[i]->getType()->getPrimitiveID())) && "Initializer for struct element doesn't match struct element type!"); Operands.push_back(Use(V[i], this)); } diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index 7738955..d649d08 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -206,10 +206,9 @@ static std::string getTypeDescription(const Type *Ty, case Type::StructTyID: { const StructType *STy = cast<StructType>(Ty); Result = "{ "; - for (StructType::ElementTypes::const_iterator - I = STy->getElementTypes().begin(), - E = STy->getElementTypes().end(); I != E; ++I) { - if (I != STy->getElementTypes().begin()) + for (StructType::element_iterator I = STy->element_begin(), + E = STy->element_end(); I != E; ++I) { + if (I != STy->element_begin()) Result += ", "; Result += getTypeDescription(*I, TypeStack); } @@ -512,12 +511,10 @@ static bool TypesEqual(const Type *Ty, const Type *Ty2, return TypesEqual(PTy->getElementType(), cast<PointerType>(Ty2)->getElementType(), EqTypes); } else if (const StructType *STy = dyn_cast<StructType>(Ty)) { - const StructType::ElementTypes &STyE = STy->getElementTypes(); - const StructType::ElementTypes &STyE2 = - cast<StructType>(Ty2)->getElementTypes(); - if (STyE.size() != STyE2.size()) return false; - for (unsigned i = 0, e = STyE.size(); i != e; ++i) - if (!TypesEqual(STyE[i], STyE2[i], EqTypes)) + const StructType *STy2 = cast<StructType>(Ty2); + if (STy->getNumElements() != STy2->getNumElements()) return false; + for (unsigned i = 0, e = STy2->getNumElements(); i != e; ++i) + if (!TypesEqual(STy->getElementType(i), STy2->getElementType(i), EqTypes)) return false; return true; } else if (const ArrayType *ATy = dyn_cast<ArrayType>(Ty)) { @@ -815,9 +812,9 @@ public: static StructValType get(const StructType *ST) { std::vector<const Type *> ElTypes; - ElTypes.reserve(ST->getElementTypes().size()); - for (unsigned i = 0, e = ST->getElementTypes().size(); i != e; ++i) - ElTypes.push_back(ST->getElementTypes()[i]); + ElTypes.reserve(ST->getNumElements()); + for (unsigned i = 0, e = ST->getNumElements(); i != e; ++i) + ElTypes.push_back(ST->getElementType(i)); return StructValType(ElTypes); } |