Add a value_type typedef to SmallVector, to make it more compatible with STL adapters.
[oota-llvm.git] / include / llvm / Type.h
index fe3c392c7c6cd03f597aca9ead7c76c7800fcc7f..5bcb654a4a907d8e293965fb578a91192dbb9373 100644 (file)
@@ -392,6 +392,17 @@ inline void PATypeHandle::removeUser() {
 
 // Define inline methods for PATypeHolder.
 
+/// 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.
+///
+inline Type* PATypeHolder::get() const {
+  const Type *NewTy = Ty->getForwardedType();
+  if (!NewTy) return const_cast<Type*>(Ty);
+  return *const_cast<PATypeHolder*>(this) = NewTy;
+}
+
 inline void PATypeHolder::addRef() {
   assert(Ty && "Type Holder has a null type!");
   if (Ty->isAbstract())