aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/TargetData.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/TargetData.cpp')
-rw-r--r--lib/Target/TargetData.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp
index 1f576f5490..b5077e4c65 100644
--- a/lib/Target/TargetData.cpp
+++ b/lib/Target/TargetData.cpp
@@ -367,6 +367,18 @@ public:
}
}
+ void InvalidateEntry(const StructType *Ty) {
+ LayoutInfoTy::iterator I = this->find(Ty);
+ if (I == this->end()) return;
+
+ I->second->~StructLayout();
+ free(I->second);
+ this->erase(I);
+
+ if (Ty->isAbstract())
+ Ty->removeAbstractTypeUser(this);
+ }
+
LayoutInfoTy::iterator end() {
return LayoutInfo.end();
}
@@ -427,15 +439,7 @@ void TargetData::InvalidateStructLayoutInfo(const StructType *Ty) const {
if (!LayoutMap) return; // No cache.
StructLayoutMap *STM = static_cast<StructLayoutMap*>(LayoutMap);
- StructLayoutMap::LayoutInfoTy::iterator I = STM->find(Ty);
- if (I == STM->end()) return;
-
- I->second->~StructLayout();
- free(I->second);
- STM->erase(I);
-
- if (Ty->isAbstract())
- Ty->removeAbstractTypeUser(STM);
+ STM->InvalidateEntry(Ty);
}
std::string TargetData::getStringRepresentation() const {