diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index 2c1c5e63551..2a5b572a115 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -318,9 +318,7 @@ unsigned TargetData::getAlignmentInfo(AlignTypeEnum AlignType, namespace { class StructLayoutMap : public AbstractTypeUser { -public: typedef DenseMap LayoutInfoTy; -private: LayoutInfoTy LayoutInfo; /// refineAbstractType - The callback method invoked when an abstract type is @@ -329,12 +327,7 @@ private: /// virtual void refineAbstractType(const DerivedType *OldTy, const Type *) { - const StructType *STy = cast(OldTy); - LayoutInfoTy::iterator Iter = LayoutInfo.find(STy); - Iter->second->~StructLayout(); - free(Iter->second); - LayoutInfo.erase(Iter); - OldTy->removeAbstractTypeUser(this); + InvalidateEntry(cast(OldTy)); } /// typeBecameConcrete - The other case which AbstractTypeUsers must be aware @@ -343,12 +336,7 @@ private: /// This method notifies ATU's when this occurs for a type. /// virtual void typeBecameConcrete(const DerivedType *AbsTy) { - const StructType *STy = cast(AbsTy); - LayoutInfoTy::iterator Iter = LayoutInfo.find(STy); - Iter->second->~StructLayout(); - free(Iter->second); - LayoutInfo.erase(Iter); - AbsTy->removeAbstractTypeUser(this); + InvalidateEntry(cast(AbsTy)); } public: