[llvm-commits] [llvm] r99732 - /llvm/trunk/lib/VMCore/Type.cpp

Jeffrey Yasskin jyasskin at google.com
Sat Mar 27 18:03:48 PDT 2010


Author: jyasskin
Date: Sat Mar 27 20:03:47 2010
New Revision: 99732

URL: http://llvm.org/viewvc/llvm-project?rev=99732&view=rev
Log:
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.

Modified:
    llvm/trunk/lib/VMCore/Type.cpp

Modified: llvm/trunk/lib/VMCore/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=99732&r1=99731&r2=99732&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Type.cpp (original)
+++ llvm/trunk/lib/VMCore/Type.cpp Sat Mar 27 20:03:47 2010
@@ -57,6 +57,11 @@
 /// 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 @@
     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





More information about the llvm-commits mailing list