summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2010-03-28 01:03:47 +0000
committerJeffrey Yasskin <jyasskin@google.com>2010-03-28 01:03:47 +0000
commit3f28c8809d464fb8c7e529bb1de1d5742622d043 (patch)
tree7f431f003d139b688756303d22dbbb1bb551f25d /llvm/lib/VMCore
parentc04832252305df493641c714a31a9b0add598085 (diff)
downloadbcm5719-llvm-3f28c8809d464fb8c7e529bb1de1d5742622d043.tar.gz
bcm5719-llvm-3f28c8809d464fb8c7e529bb1de1d5742622d043.zip
Oops, r98447 dropped the reference to ForwardType in the wrong place in
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. llvm-svn: 99732
Diffstat (limited to 'llvm/lib/VMCore')
-rw-r--r--llvm/lib/VMCore/Type.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/VMCore/Type.cpp b/llvm/lib/VMCore/Type.cpp
index 2a0cfa8470e..5f9c11fc0ed 100644
--- a/llvm/lib/VMCore/Type.cpp
+++ b/llvm/lib/VMCore/Type.cpp
@@ -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
@@ -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
OpenPOWER on IntegriCloud