diff gen/toobj.cpp @ 1535:61f12f4651b5

Don't use llvm::getGlobalContext() anymore
author Benjamin Kramer <benny.kra@gmail.com>
date Mon, 13 Jul 2009 20:16:15 +0200
parents 8ca25bd765a3
children 1e7a09548e67
line wrap: on
line diff
--- a/gen/toobj.cpp	Mon Jul 13 12:17:58 2009 +0200
+++ b/gen/toobj.cpp	Mon Jul 13 20:16:15 2009 +0200
@@ -71,7 +71,7 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////
 
-llvm::Module* Module::genLLVMModule(Ir* sir)
+llvm::Module* Module::genLLVMModule(llvm::LLVMContext& context, Ir* sir)
 {
     bool logenabled = Logger::enabled();
     if (llvmForceLogging && !logenabled)
@@ -94,7 +94,7 @@
 
     // create a new ir state
     // TODO look at making the instance static and moving most functionality into IrModule where it belongs
-    IRState ir(new llvm::Module(mname, llvm::getGlobalContext()));
+    IRState ir(new llvm::Module(mname, context));
     gIR = &ir;
     ir.dmodule = this;
 
@@ -554,7 +554,7 @@
     // provide the default initializer
     const LLStructType* modulerefTy = DtoModuleReferenceType();
     std::vector<LLConstant*> mrefvalues;
-    mrefvalues.push_back(llvm::getGlobalContext().getNullValue(modulerefTy->getContainedType(0)));
+    mrefvalues.push_back(gIR->context().getNullValue(modulerefTy->getContainedType(0)));
     mrefvalues.push_back(llvm::ConstantExpr::getBitCast(moduleinfo, modulerefTy->getContainedType(1)));
     LLConstant* thismrefinit = LLConstantStruct::get(modulerefTy, mrefvalues);