[llvm-dev] LLVMContext

Mehdi AMINI via llvm-dev llvm-dev at lists.llvm.org
Sat Jan 25 17:03:00 PST 2020


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;
}

-- 
Mehdi


On Sat, Jan 25, 2020 at 4:52 PM Abid Malik via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> 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,
>
> --
> Abid M. Malik
> ******************************************************
> "I have learned silence from the talkative, toleration from the
> intolerant, and kindness from the unkind"---Gibran
> "Success is not for the chosen few, but for the few who choose" --- John
> Maxwell
> "Being a good person does not depend on your religion or status in life,
> your race or skin color, political views or culture. IT DEPENDS ON HOW GOOD
> YOU TREAT OTHERS"--- Abid
> "The Universe is talking to us, and the language of the Universe is
> mathematics."----Abid
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200125/fb62effc/attachment.html>


More information about the llvm-dev mailing list