Refactor some code. No functionality change.
authorBill Wendling <isanbard@gmail.com>
Sat, 5 Dec 2009 01:43:33 +0000 (01:43 +0000)
committerBill Wendling <isanbard@gmail.com>
Sat, 5 Dec 2009 01:43:33 +0000 (01:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90639 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/TargetData.cpp

index 1f576f54900eb6f3c64c43e56312b7fd2d21961b..b5077e4c653ad3fccaf244f768e5310b6df37fdf 100644 (file)
@@ -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 {