aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/LLVMContext.h
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2010-09-08 18:03:32 +0000
committerOwen Anderson <resistor@mac.com>2010-09-08 18:03:32 +0000
commit30268be89df6444f5ffb585439b3fbfec9055197 (patch)
treef9ba791b35b94fe6acf0aeab46e1e4f394b23b73 /include/llvm/LLVMContext.h
parent1485cc2bb386aa07c2598f65e4cc10edd2f0a065 (diff)
downloadexternal_llvm-30268be89df6444f5ffb585439b3fbfec9055197.zip
external_llvm-30268be89df6444f5ffb585439b3fbfec9055197.tar.gz
external_llvm-30268be89df6444f5ffb585439b3fbfec9055197.tar.bz2
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 'include/llvm/LLVMContext.h')
-rw-r--r--include/llvm/LLVMContext.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/LLVMContext.h b/include/llvm/LLVMContext.h
index 7cb6579..76492b7 100644
--- a/include/llvm/LLVMContext.h
+++ b/include/llvm/LLVMContext.h
@@ -20,6 +20,7 @@ namespace llvm {
class LLVMContextImpl;
class StringRef;
class Instruction;
+class Module;
template <typename T> class SmallVectorImpl;
/// This is an important class for using LLVM in a threaded context. It
@@ -37,6 +38,13 @@ public:
LLVMContext();
~LLVMContext();
+ /// addModule - Register a module as being instantiated in this context. If
+ /// the context is deleted, the module will be deleted as well.
+ void addModule(Module*);
+
+ /// removeModule - Unregister a module from this context.
+ void removeModule(Module*);
+
// Pinned metadata names, which always have the same value. This is a
// compile-time performance optimization, not a correctness optimization.
enum {