LLVMContext

Hello,

Is getGlobalContext() still available? I could not find it in the LLVMContext.h.

I am trying to initialize the context as :

static LLVMContext &Context;

static Module *ModuleOb = new Module(“test compiler”, Context);

and getting an error:

error: use of undeclared identifier ‘getGlobalContext’
static LLVMContext &Context = getGlobalContext();

Thanks,

Hi,

getGlobalContext() has been removed a few years ago.
You need to manage the lifetime of the context yourself. If you want to get the previous behavior, you can likely just add to your project:

LLVMContext &getGlobalContext() {
static LLVMContext context;
return context;
}