From 30268be89df6444f5ffb585439b3fbfec9055197 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Wed, 8 Sep 2010 18:03:32 +0000 Subject: Clarify the ownership model of LLVMContext and Module. Namely, contexts own modules are instantiated in them. If the context is deleted, all of its owned modules are also deleted. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113374 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/VMCore/Module.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/VMCore/Module.cpp') diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp index d7ddf96cb0..341e527acb 100644 --- a/lib/VMCore/Module.cpp +++ b/lib/VMCore/Module.cpp @@ -62,9 +62,11 @@ Module::Module(StringRef MID, LLVMContext& C) ValSymTab = new ValueSymbolTable(); TypeSymTab = new TypeSymbolTable(); NamedMDSymTab = new StringMap(); + Context.addModule(this); } Module::~Module() { + Context.removeModule(this); dropAllReferences(); GlobalList.clear(); FunctionList.clear(); -- cgit v1.2.3-18-g5258