Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What should I replace getGlobalContext() with in LLVM 3.9.1?

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?

like image 367
Shuzheng Avatar asked Jan 20 '17 09:01

Shuzheng


2 Answers

you just can use

static LLVMContext TheContext;

like image 162
Boris Avatar answered Nov 14 '22 23:11

Boris


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().

like image 39
Ewan Mellor Avatar answered Nov 14 '22 21:11

Ewan Mellor