Another attempt at fixing PR2975.

Types can have references to eachother, so we can't just call destroy on them.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68523 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Torok Edwin
2009-04-07 17:23:02 +00:00
parent ce8f9fe3c9
commit eb55f3ea3c
3 changed files with 32 additions and 1 deletions
+3 -1
View File
@@ -137,6 +137,7 @@ public:
///
class PATypeHolder {
mutable const Type *Ty;
void destroy();
public:
PATypeHolder(const Type *ty) : Ty(ty) {
addRef();
@@ -145,7 +146,7 @@ public:
addRef();
}
~PATypeHolder() { dropRef(); }
~PATypeHolder() { if (Ty) dropRef(); }
operator Type *() const { return get(); }
Type *get() const;
@@ -173,6 +174,7 @@ public:
private:
void addRef();
void dropRef();
friend class TypeMapBase;
};
// simplify_type - Allow clients to treat uses just like values when using