From: Chris Lattner Date: Fri, 19 Nov 2004 16:39:04 +0000 (+0000) Subject: Add static functions to clear singleton maps. Patch contributed by X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=5b2d43aad08a1f8f6f48a946b5c587524b171ac9;p=oota-llvm.git Add static functions to clear singleton maps. Patch contributed by Morten Ofstad! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17994 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Constant.h b/include/llvm/Constant.h index 789fe702818..0d098a60745 100644 --- a/include/llvm/Constant.h +++ b/include/llvm/Constant.h @@ -92,6 +92,11 @@ public: "implemented for all constants that have operands!"); assert(0 && "Constants that do not have operands cannot be using 'From'!"); } + + /// clearAllValueMaps - This method frees all internal memory used by the + /// constant subsystem, which can be used in environments where this memory + /// is otherwise reported as a leak. + static void clearAllValueMaps(); }; } // End llvm namespace diff --git a/include/llvm/Type.h b/include/llvm/Type.h index 9602fd5a57a..18b8adb0cee 100644 --- a/include/llvm/Type.h +++ b/include/llvm/Type.h @@ -288,7 +288,7 @@ public: } void dropRef() const { - assert(isAbstract() && "Cannot drop a refernce to a non-abstract type!"); + assert(isAbstract() && "Cannot drop a reference to a non-abstract type!"); assert(RefCount && "No objects are currently referencing this object!"); // If this is the last PATypeHolder using this object, and there are no @@ -296,6 +296,12 @@ public: if (--RefCount == 0) RefCountIsZero(); } + + /// clearAllTypeMaps - This method frees all internal memory used by the + /// type subsystem, which can be used in environments where this memory is + /// otherwise reported as a leak. + static void clearAllTypeMaps(); + private: /// isSizedDerivedType - Derived types like structures and arrays are sized /// iff all of the members of the type are sized as well. Since asking for