diff options
author | Owen Anderson <resistor@mac.com> | 2010-09-08 18:03:32 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2010-09-08 18:03:32 +0000 |
commit | 30268be89df6444f5ffb585439b3fbfec9055197 (patch) | |
tree | f9ba791b35b94fe6acf0aeab46e1e4f394b23b73 /lib/VMCore/Module.cpp | |
parent | 1485cc2bb386aa07c2598f65e4cc10edd2f0a065 (diff) |
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
Diffstat (limited to 'lib/VMCore/Module.cpp')
-rw-r--r-- | lib/VMCore/Module.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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<NamedMDNode *>(); + Context.addModule(this); } Module::~Module() { + Context.removeModule(this); dropAllReferences(); GlobalList.clear(); FunctionList.clear(); |