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.
llvm-svn: 113374
diff --git a/llvm/lib/VMCore/LLVMContextImpl.h b/llvm/lib/VMCore/LLVMContextImpl.h
index 51b2992..6df804a 100644
--- a/llvm/lib/VMCore/LLVMContextImpl.h
+++ b/llvm/lib/VMCore/LLVMContextImpl.h
@@ -115,6 +115,10 @@
class LLVMContextImpl {
public:
+ /// OwnedModules - The set of modules instantiated in this context, and which
+ /// will be automatically deleted if this context is deleted.
+ SmallPtrSet<Module*, 4> OwnedModules;
+
void *InlineAsmDiagHandler, *InlineAsmDiagContext;
typedef DenseMap<DenseMapAPIntKeyInfo::KeyTy, ConstantInt*,