summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Module.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-09-08 18:59:35 +0000
committerChris Lattner <sabre@nondot.org>2002-09-08 18:59:35 +0000
commit184b298edcf86613b6d5ba8efc4c6055351a7fcc (patch)
treeee5a136b781090cdc326ace1473ea839ef1c2796 /llvm/lib/VMCore/Module.cpp
parentbdb147c37312365ed70d16c954a3ff066eb0bf78 (diff)
downloadbcm5719-llvm-184b298edcf86613b6d5ba8efc4c6055351a7fcc.tar.gz
bcm5719-llvm-184b298edcf86613b6d5ba8efc4c6055351a7fcc.zip
Enable "garbage detection" of LLVM objects. Now users should be obnoxious
warnings. If they accidentally leak LLVM Value's. llvm-svn: 3620
Diffstat (limited to 'llvm/lib/VMCore/Module.cpp')
-rw-r--r--llvm/lib/VMCore/Module.cpp14
1 files changed, 11 insertions, 3 deletions
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 <algorithm>
#include <map>
Function *ilist_traits<Function>::createNode() {
- return new Function(FunctionType::get(Type::VoidTy,std::vector<const Type*>(),
- false), false);
+ FunctionType *FTy =
+ FunctionType::get(Type::VoidTy, std::vector<const Type*>(), false);
+ Function *Ret = new Function(FTy, false);
+ // This should not be garbage monitored.
+ LeakDetector::removeGarbageObject(Ret);
+ return Ret;
}
GlobalVariable *ilist_traits<GlobalVariable>::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<Function> &ilist_traits<Function>::getList(Module *M) {
OpenPOWER on IntegriCloud