diff --git a/include/llvm/Type.h b/include/llvm/Type.h index fe3c392c7c6..5bcb654a4a9 100644 --- a/include/llvm/Type.h +++ b/include/llvm/Type.h @@ -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(Ty); + return *const_cast(this) = NewTy; +} + inline void PATypeHolder::addRef() { assert(Ty && "Type Holder has a null type!"); if (Ty->isAbstract()) diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index b7bf339ab8d..be211949799 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -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(Ty); - return *const_cast(this) = NewTy; -} - //===----------------------------------------------------------------------===// // Type Class Implementation //===----------------------------------------------------------------------===//