From 184b298edcf86613b6d5ba8efc4c6055351a7fcc Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 8 Sep 2002 18:59:35 +0000 Subject: Enable "garbage detection" of LLVM objects. Now users should be obnoxious warnings. If they accidentally leak LLVM Value's. llvm-svn: 3620 --- llvm/lib/VMCore/Module.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'llvm/lib/VMCore/Module.cpp') diff --git a/llvm/lib/VMCore/Module.cpp b/llvm/lib/VMCore/Module.cpp index a895929280d..4bd3a884b30 100644 --- a/llvm/lib/VMCore/Module.cpp +++ b/llvm/lib/VMCore/Module.cpp @@ -9,16 +9,24 @@ #include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "Support/STLExtras.h" +#include "Support/LeakDetector.h" #include "SymbolTableListTraitsImpl.h" #include #include Function *ilist_traits::createNode() { - return new Function(FunctionType::get(Type::VoidTy,std::vector(), - false), false); + FunctionType *FTy = + FunctionType::get(Type::VoidTy, std::vector(), false); + Function *Ret = new Function(FTy, false); + // This should not be garbage monitored. + LeakDetector::removeGarbageObject(Ret); + return Ret; } GlobalVariable *ilist_traits::createNode() { - return new GlobalVariable(Type::IntTy, false, false); + GlobalVariable *Ret = new GlobalVariable(Type::IntTy, false, false); + // This should not be garbage monitored. + LeakDetector::removeGarbageObject(Ret); + return Ret; } iplist &ilist_traits::getList(Module *M) { -- cgit v1.2.3