[llvm-branch-commits] [llvm-branch] r90589 - /llvm/branches/Apple/Zoidberg/lib/Target/TargetData.cpp
Bill Wendling
isanbard at gmail.com
Fri Dec 4 13:04:04 PST 2009
Author: void
Date: Fri Dec 4 15:04:04 2009
New Revision: 90589
URL: http://llvm.org/viewvc/llvm-project?rev=90589&view=rev
Log:
$ svn merge -c 90588 https://llvm.org/svn/llvm-project/llvm/trunk
--- Merging r90588 into '.':
U lib/Target/TargetData.cpp
Modified:
llvm/branches/Apple/Zoidberg/lib/Target/TargetData.cpp
Modified: llvm/branches/Apple/Zoidberg/lib/Target/TargetData.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/Target/TargetData.cpp?rev=90589&r1=90588&r2=90589&view=diff
==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/Target/TargetData.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/Target/TargetData.cpp Fri Dec 4 15:04:04 2009
@@ -323,11 +323,12 @@
: Alignments[BestMatchIdx].PrefAlign;
}
-typedef DenseMap<const StructType*, StructLayout*> LayoutInfoTy;
-
namespace {
class StructLayoutMap : public AbstractTypeUser {
+public:
+ typedef DenseMap<const StructType*, StructLayout*> LayoutInfoTy;
+private:
LayoutInfoTy LayoutInfo;
/// refineAbstractType - The callback method invoked when an abstract type is
@@ -336,9 +337,7 @@
///
virtual void refineAbstractType(const DerivedType *OldTy,
const Type *) {
- const StructType *STy = dyn_cast<const StructType>(OldTy);
- assert(STy && "This can only track struct types.");
-
+ const StructType *STy = cast<const StructType>(OldTy);
LayoutInfoTy::iterator Iter = LayoutInfo.find(STy);
Iter->second->~StructLayout();
free(Iter->second);
@@ -352,9 +351,7 @@
/// This method notifies ATU's when this occurs for a type.
///
virtual void typeBecameConcrete(const DerivedType *AbsTy) {
- const StructType *STy = dyn_cast<const StructType>(AbsTy);
- assert(STy && "This can only track struct types.");
-
+ const StructType *STy = cast<const StructType>(AbsTy);
LayoutInfoTy::iterator Iter = LayoutInfo.find(STy);
Iter->second->~StructLayout();
free(Iter->second);
@@ -370,13 +367,11 @@
const Type *Key = I->first;
StructLayout *Value = I->second;
- if (Key && Key->isAbstract())
+ if (Key->isAbstract())
Key->removeAbstractTypeUser(this);
- if (Value) {
- Value->~StructLayout();
- free(Value);
- }
+ Value->~StructLayout();
+ free(Value);
}
}
@@ -400,7 +395,7 @@
virtual void dump() const {}
};
-} // end namespace llvm
+} // end anonymous namespace
TargetData::~TargetData() {
delete static_cast<StructLayoutMap*>(LayoutMap);
@@ -440,7 +435,7 @@
if (!LayoutMap) return; // No cache.
StructLayoutMap *STM = static_cast<StructLayoutMap*>(LayoutMap);
- LayoutInfoTy::iterator I = STM->find(Ty);
+ StructLayoutMap::LayoutInfoTy::iterator I = STM->find(Ty);
if (I == STM->end()) return;
I->second->~StructLayout();
More information about the llvm-branch-commits
mailing list