6

Doing old tutorials, I often see getGlobalContext() used. However, in LLVM 3.9.1, this function can no longer be found.

What should I replace these calls with for equivalent behaviour?

Shuzheng
  • 11,288
  • 20
  • 88
  • 186

2 Answers2

9

you just can use

static LLVMContext TheContext;

Boris
  • 191
  • 7
2

I found this review very useful: https://reviews.llvm.org/rL266379

It shows the tutorials being changed in llvm/docs to match the new API. They are replacing getGlobalContext() with code to allocate an LLVMContext to match the usage (static if it's being used with a static IRBuilder, for example).

So basically, make your own LLVMContext instead of using getGlobalContext().

Ewan Mellor
  • 6,747
  • 1
  • 24
  • 39