aboutsummaryrefslogtreecommitdiff
path: root/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
commitd1e693f2a3883dacf213aa2b477540c57b53b714 (patch)
tree46b79948a66f3765a515c8cccaf2f7995a29c8ce /lib/VMCore/Module.cpp
parentbd78696719a77c0ab4876901f2fa4dcbed234e46 (diff)
Enable "garbage detection" of LLVM objects. Now users should be obnoxious
warnings. If they accidentally leak LLVM Value's. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3620 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Module.cpp')
-rw-r--r--lib/VMCore/Module.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp
index a895929280..4bd3a884b3 100644
--- a/lib/VMCore/Module.cpp
+++ b/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) {