diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp index c5b986eb728..805b7549373 100644 --- a/lib/Target/TargetData.cpp +++ b/lib/Target/TargetData.cpp @@ -208,17 +208,18 @@ TargetData::TargetData(const Module *M) { /// targets with cached elements should have been destroyed. /// typedef std::pair LayoutKey; -static ManagedStatic > LayoutInfo; +typedef std::map LayoutInfoTy; +static ManagedStatic LayoutInfo; TargetData::~TargetData() { if (LayoutInfo.isConstructed()) { // Remove any layouts for this TD. - std::map &TheMap = *LayoutInfo; - std::map::iterator + LayoutInfoTy &TheMap = *LayoutInfo; + LayoutInfoTy::iterator I = TheMap.lower_bound(LayoutKey(this, (const StructType*)0)); - for (std::map::iterator E = TheMap.end(); + for (LayoutInfoTy::iterator E = TheMap.end(); I != E && I->first.first == this; ) { I->second->~StructLayout(); free(I->second); @@ -228,10 +229,9 @@ TargetData::~TargetData() { } const StructLayout *TargetData::getStructLayout(const StructType *Ty) const { - std::map &TheMap = *LayoutInfo; + LayoutInfoTy &TheMap = *LayoutInfo; - std::map::iterator - I = TheMap.lower_bound(LayoutKey(this, Ty)); + LayoutInfoTy::iterator I = TheMap.lower_bound(LayoutKey(this, Ty)); if (I != TheMap.end() && I->first.first == this && I->first.second == Ty) return I->second; @@ -253,8 +253,7 @@ const StructLayout *TargetData::getStructLayout(const StructType *Ty) const { void TargetData::InvalidateStructLayoutInfo(const StructType *Ty) const { if (!LayoutInfo.isConstructed()) return; // No cache. - std::map::iterator I = - LayoutInfo->find(LayoutKey(this, Ty)); + LayoutInfoTy::iterator I = LayoutInfo->find(LayoutKey(this, Ty)); if (I != LayoutInfo->end()) { I->second->~StructLayout(); free(I->second);