Missed the complexities of how these elements are destroyed.
This reverts commit r222714.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222715
91177308-0d34-0410-b5e6-
96231b3b80d8
ConstantAggregateZero *ConstantAggregateZero::get(Type *Ty) {
assert((Ty->isStructTy() || Ty->isArrayTy() || Ty->isVectorTy()) &&
"Cannot create an aggregate zero of non-aggregate type!");
-
- auto &Entry = Ty->getContext().pImpl->CAZConstants[Ty];
+
+ ConstantAggregateZero *&Entry = Ty->getContext().pImpl->CAZConstants[Ty];
if (!Entry)
- Entry.reset(new ConstantAggregateZero(Ty));
+ Entry = new ConstantAggregateZero(Ty);
- return Entry.get();
+ return Entry;
}
/// destroyConstant - Remove the constant from the constant table.
ArrayConstants.freeConstants();
StructConstants.freeConstants();
VectorConstants.freeConstants();
- CAZConstants.clear();
+ DeleteContainerSeconds(CAZConstants);
DeleteContainerSeconds(CPNConstants);
DeleteContainerSeconds(UVConstants);
InlineAsms.freeConstants();
// on Context destruction.
SmallPtrSet<GenericMDNode *, 1> NonUniquedMDNodes;
- // Value is indirected through pointer to keep pointer validity over mutations
- // of this map. Replace if/when we have an efficient map that guarantees
- // pointer validity over mutations.
- DenseMap<Type*, std::unique_ptr<ConstantAggregateZero>> CAZConstants;
+ DenseMap<Type*, ConstantAggregateZero*> CAZConstants;
typedef ConstantUniqueMap<ConstantArray> ArrayConstantsTy;
ArrayConstantsTy ArrayConstants;