I am attempting to follow the https://github.com/lsegal/my_toy_compiler, but even though it has been updated for LLVM 3.8.0, I am unable to get it to compile using LLVM 3.8.4 from brew with --with-clang --with-lld --with-jit --with-python
. Specifically I get the following error, use of undeclared identifier 'getGlobalContext'
.
Additionally the symbol getGlobalContext
does not appear in the /usr/local/opt/llvm/include/llvm/IR/LLVMContext.h
or indeed anywhere in the /usr/local/opt/llvm/include
directory.
I expect that either this function has been deprecated recently, (for which I have not been able to find any evidence), or that I am not building it correctly.
Any tips would be appreciated.
NOTE I have seen Trouble linking against LLVM with project including Flex and Bison and it did not resolve my particular problem
I also encountered the same problem with llvm 4.0. My solution is as follows.
old:
LLVMContext *llvmcx;
llvmcx = &getGlobalContext();
new:
LLVMContext *llvmcx;
static LLVMContext MyGlobalContext;
llvmcx = &MyGlobalContext;
I have the same problem with 4.0.0 version built from svn. I've found the following commit 266379 with the removing all occurrences of getGlobalConfig()
https://reviews.llvm.org/rL266379
This commit changes examples either defining internal context variable:
Was:
static IRBuilder<> Builder(getGlobalContext());
Become:
static LLVMContext TheContext;
static IRBuilder<> Builder(TheContext);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With