aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-04-04 19:26:02 +0000
committerChris Lattner <sabre@nondot.org>2002-04-04 19:26:02 +0000
commitaa06d2c1034c70fe6a68ab0579d8b13c2398f09f (patch)
treef97cc00dc7c4760a95224b800594acb4c085a939 /lib/VMCore
parent22c3982cd390102d29bad01cc603bb66c475b05a (diff)
downloadexternal_llvm-aa06d2c1034c70fe6a68ab0579d8b13c2398f09f.zip
external_llvm-aa06d2c1034c70fe6a68ab0579d8b13c2398f09f.tar.gz
external_llvm-aa06d2c1034c70fe6a68ab0579d8b13c2398f09f.tar.bz2
* 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
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Type.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index c8a5426..798c522 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -32,6 +32,10 @@ using std::cerr;
static unsigned CurUID = 0;
static vector<const Type *> 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<Type> 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.