Skip to content

Commit

Permalink
Oops, r98447 dropped the reference to ForwardType in the wrong place in
Browse files Browse the repository at this point in the history
Type::destroy(), so it got skipped for FunctionTypes, StructTypes, and
UnionTypes.  This fixes the resulting leaks in test/Feature/opaquetypes.ll and
test/Integer/opaquetypes_bt.ll.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99732 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
jyasskin committed Mar 28, 2010
1 parent b4a52b0 commit ec24347
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/VMCore/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ void AbstractTypeUser::setType(Value *V, const Type *NewTy) {
/// need for a std::vector to be used in the Type class itself.
/// @brief Type destruction function
void Type::destroy() const {
// Nothing calls getForwardedType from here on.
if (ForwardType && ForwardType->isAbstract()) {
ForwardType->dropRef();
ForwardType = NULL;
}

// Structures and Functions allocate their contained types past the end of
// the type object itself. These need to be destroyed differently than the
Expand Down Expand Up @@ -87,11 +92,6 @@ void Type::destroy() const {
pImpl->OpaqueTypes.erase(opaque_this);
}

if (ForwardType && ForwardType->isAbstract()) {
ForwardType->dropRef();
ForwardType = NULL;
}

// For all the other type subclasses, there is either no contained types or
// just one (all Sequentials). For Sequentials, the PATypeHandle is not
// allocated past the type object, its included directly in the SequentialType
Expand Down

0 comments on commit ec24347

Please sign in to comment.