+ 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]);
+ return ConstantStruct::get(ST, Elements);
+ }
+ case Type::ArrayTyID: {
+ const ArrayType *AT = cast<ArrayType>(Ty);
+ Constant *El = Constant::getNullValue(AT->getElementType());
+ unsigned NumElements = AT->getNumElements();
+ return ConstantArray::get(AT, std::vector<Constant*>(NumElements, El));
+ }