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 | 8e89e41fafaa372175b7f5b1676b2a20916b88d7 (patch) | |
tree | 02514e3a3aaca3d90b184ff55bdd94652ebb877c /llvm/lib/VMCore/LLVMContext.cpp | |
parent | 10b9b7b4bdeaa5e714542072092a61e6999af830 (diff) | |
download | bcm5719-llvm-8e89e41fafaa372175b7f5b1676b2a20916b88d7.tar.gz bcm5719-llvm-8e89e41fafaa372175b7f5b1676b2a20916b88d7.zip |
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
Diffstat (limited to 'llvm/lib/VMCore/LLVMContext.cpp')
-rw-r--r-- | llvm/lib/VMCore/LLVMContext.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/LLVMContext.cpp b/llvm/lib/VMCore/LLVMContext.cpp index 563c651315a..60fb830e9b5 100644 --- a/llvm/lib/VMCore/LLVMContext.cpp +++ b/llvm/lib/VMCore/LLVMContext.cpp @@ -34,6 +34,14 @@ LLVMContext::LLVMContext() : pImpl(new LLVMContextImpl(*this)) { } LLVMContext::~LLVMContext() { delete pImpl; } +void LLVMContext::addModule(Module *M) { + pImpl->OwnedModules.insert(M); +} + +void LLVMContext::removeModule(Module *M) { + pImpl->OwnedModules.erase(M); +} + //===----------------------------------------------------------------------===// // Recoverable Backend Errors //===----------------------------------------------------------------------===// |