aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore')
-rw-r--r--lib/VMCore/Core.cpp16
-rw-r--r--lib/VMCore/Module.cpp5
2 files changed, 17 insertions, 4 deletions
diff --git a/lib/VMCore/Core.cpp b/lib/VMCore/Core.cpp
index f85dbe7..1c0a8f7 100644
--- a/lib/VMCore/Core.cpp
+++ b/lib/VMCore/Core.cpp
@@ -18,6 +18,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/GlobalVariable.h"
#include "llvm/GlobalAlias.h"
+#include "llvm/LLVMContext.h"
#include "llvm/TypeSymbolTable.h"
#include "llvm/ModuleProvider.h"
#include "llvm/InlineAsm.h"
@@ -38,10 +39,21 @@ void LLVMDisposeMessage(char *Message) {
}
+/*===-- Operations on contexts --------------------------------------------===*/
+
+LLVMContextRef LLVMContextCreate() {
+ return wrap(new LLVMContext());
+}
+
+void LLVMContextDispose(LLVMContextRef C) {
+ delete unwrap(C);
+}
+
+
/*===-- Operations on modules ---------------------------------------------===*/
-LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID) {
- return wrap(new Module(ModuleID));
+LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID, LLVMContextRef C) {
+ return wrap(new Module(ModuleID, unwrap(C)));
}
void LLVMDisposeModule(LLVMModuleRef M) {
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp
index a598005..96a25a5 100644
--- a/lib/VMCore/Module.cpp
+++ b/lib/VMCore/Module.cpp
@@ -15,6 +15,7 @@
#include "llvm/InstrTypes.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
+#include "llvm/LLVMContext.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/LeakDetector.h"
@@ -54,8 +55,8 @@ template class SymbolTableListTraits<GlobalAlias, Module>;
// Primitive Module methods.
//
-Module::Module(const std::string &MID)
- : ModuleID(MID), DataLayout("") {
+Module::Module(const std::string &MID, LLVMContext* C)
+ : Context(C), ModuleID(MID), DataLayout("") {
ValSymTab = new ValueSymbolTable();
TypeSymTab = new TypeSymbolTable();
}