git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@244043
91177308-0d34-0410-b5e6-
96231b3b80d8
if (isPacked)
setSubclassData(getSubclassData() | SCDB_Packed);
+ NumContainedTys = Elements.size();
+
if (Elements.empty()) {
ContainedTys = nullptr;
- NumContainedTys = 0;
return;
}
- unsigned NumElements = Elements.size();
- Type **Elts = getContext().pImpl->TypeAllocator.Allocate<Type*>(NumElements);
- memcpy(Elts, Elements.data(), sizeof(Elements[0]) * NumElements);
-
- ContainedTys = Elts;
- NumContainedTys = NumElements;
+ ContainedTys = Elements.copy(getContext().pImpl->TypeAllocator).data();
}
void StructType::setName(StringRef Name) {