CMake: removed lib/VMCore/DebugInfoBuilder.cpp.
[oota-llvm.git] / lib / VMCore / Type.cpp
index 90258edbda2a3393142da082025f427ea194e520..be211949799ebfd0b6b342344bb9a6e0a7cef93e 100644 (file)
@@ -34,21 +34,6 @@ using namespace llvm;
 AbstractTypeUser::~AbstractTypeUser() {}
 
 
-//===----------------------------------------------------------------------===//
-//                         Type PATypeHolder Implementation
-//===----------------------------------------------------------------------===//
-
-/// get - This implements the forwarding part of the union-find algorithm for
-/// abstract types.  Before every access to the Type*, we check to see if the
-/// type we are pointing to is forwarding to a new type.  If so, we drop our
-/// reference to the type.
-///
-Type* PATypeHolder::get() const {
-  const Type *NewTy = Ty->getForwardedType();
-  if (!NewTy) return const_cast<Type*>(Ty);
-  return *const_cast<PATypeHolder*>(this) = NewTy;
-}
-
 //===----------------------------------------------------------------------===//
 //                         Type Class Implementation
 //===----------------------------------------------------------------------===//
@@ -84,9 +69,9 @@ void Type::destroy() const {
     // Now call the destructor for the subclass directly because we're going
     // to delete this as an array of char.
     if (isa<FunctionType>(this))
-      ((FunctionType*)this)->FunctionType::~FunctionType();
+      static_cast<const FunctionType*>(this)->FunctionType::~FunctionType();
     else
-      ((StructType*)this)->StructType::~StructType();
+      static_cast<const StructType*>(this)->StructType::~StructType();
 
     // Finally, remove the memory as an array deallocation of the chars it was
     // constructed from.
@@ -251,8 +236,8 @@ static std::string getTypeDescription(const Type *Ty,
                                       std::vector<const Type *> &TypeStack) {
   if (isa<OpaqueType>(Ty)) {                     // Base case for the recursion
     std::map<const Type*, std::string>::iterator I =
-      AbstractTypeDescriptions->lower_bound(Ty);
-    if (I != AbstractTypeDescriptions->end() && I->first == Ty)
+      AbstractTypeDescriptions->find(Ty);
+    if (I != AbstractTypeDescriptions->end())
       return I->second;
     std::string Desc = "opaque";
     AbstractTypeDescriptions->insert(std::make_pair(Ty, Desc));
@@ -655,8 +640,8 @@ static bool TypesEqual(const Type *Ty, const Type *Ty2,
   if (isa<OpaqueType>(Ty))
     return false;  // Two unequal opaque types are never equal
 
-  std::map<const Type*, const Type*>::iterator It = EqTypes.lower_bound(Ty);
-  if (It != EqTypes.end() && It->first == Ty)
+  std::map<const Type*, const Type*>::iterator It = EqTypes.find(Ty);
+  if (It != EqTypes.end())
     return It->second == Ty2;    // Looping back on a type, check for equality
 
   // Otherwise, add the mapping to the table to make sure we don't get