From: Chris Lattner Date: Thu, 4 Apr 2002 19:26:02 +0000 (+0000) Subject: * Add debug support for PATypeHolder X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=aa06d2c1034c70fe6a68ab0579d8b13c2398f09f;p=oota-llvm.git * Add debug support for PATypeHolder * PATypeHolder is now not a template git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2108 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index c8a5426c142..798c522f03f 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -32,6 +32,10 @@ using std::cerr; static unsigned CurUID = 0; static vector UIDMappings; +void PATypeHolder::dump() const { + cerr << "PATypeHolder(" << (void*)this << ")\n"; +} + Type::Type(const string &name, PrimitiveID id) : Value(Type::TypeTy, Value::TypeVal) { setDescription(name); @@ -470,15 +474,17 @@ public: Map.erase(I); } - void print(const char *Arg) { + void print(const char *Arg) const { #ifdef DEBUG_MERGE_TYPES cerr << "TypeMap<>::" << Arg << " table contents:\n"; unsigned i = 0; - for (MapTy::iterator I = Map.begin(), E = Map.end(); I != E; ++I) + for (MapTy::const_iterator I = Map.begin(), E = Map.end(); I != E; ++I) cerr << " " << (++i) << ". " << I->second << " " << I->second->getDescription() << endl; #endif } + + void dump() const { print("dump output"); } }; @@ -518,6 +524,10 @@ protected: Table.add((ValType&)Tmp, (TypeClass*)OldType.get()); #endif } + + void dump() const { + cerr << "ValTypeBase instance!\n"; + } }; @@ -814,7 +824,7 @@ void DerivedType::refineAbstractTypeTo(const Type *NewType) { // Make sure to put the type to be refined to into a holder so that if IT gets // refined, that we will not continue using a dead reference... // - PATypeHolder NewTy(NewType); + PATypeHolder NewTy(NewType); // Add a self use of the current type so that we don't delete ourself until // after this while loop. We are careful to never invoke refine on ourself, @@ -846,9 +856,9 @@ void DerivedType::refineAbstractTypeTo(const Type *NewType) { #endif User->refineAbstractType(this, NewTy); - if (AbstractTypeUsers.size() == OldSize) { + if (AbstractTypeUsers.size() == OldSize) User->refineAbstractType(this, NewTy); - } + assert(AbstractTypeUsers.size() != OldSize && "AbsTyUser did not remove self from user list!"); } @@ -861,7 +871,6 @@ void DerivedType::refineAbstractTypeTo(const Type *NewType) { removeAbstractTypeUser(this); } - // typeIsRefined - Notify AbstractTypeUsers of this type that the current type // has been refined a bit. The pointer is still valid and still should be // used, but the subtypes have changed.