Kray-G/clang-jit

Update support from Clang 8 to Clang 13.

Opened this issue · 1 comments

Currently your jit.cpp code supports C++ API of Clang 8, but already Clang 13 is released. I suggest to update your jit.cpp code to support Clang 13.

I did all necessary modifications in order to make it compilable under Clang 13. But as I don't have deep knowledge of Clang C++ library API hence I didn't more like syntaxical compilation fixes without much thinking.

Here is my version of jit.cpp, only this file should be modified. In order to see all changes in code just do windiff jit_old.cpp jit_new.cpp (WinDiff is standard tool under Windows).

I didn't make any Pull request first because I never did any so I don't know much details of how to do that. And second, more important, because I fixed only compilation issues but don't know if it is correct. It needs your expert look at modification in order to figure out if all is alright.

My code works (compilable) and tested both under MSVC 2022 and Win Clang 13. If I run compiled program on fib.c then it gives correct answer and doesn't crash (program successfully finishes).

There is one TODO word in my code, this is the place where I didn't manage to fix code correctly. It is the place where codeGenOptions.DebugPassManager option is used to construct object of llvm::ModuleAnalysisManager type (and other similar managers). I didn't fix this place correctly in a sence that I had to remove option codeGenOptions.DebugPassManager totally in order to make it compilable, hence now these managers will run without debug pass (or debug info?).

I didn't compile Clang 13 myself, but took pre-compiled build from ZigLang github page, from here, precise pre-compiled version that I used is this one (this link may become invalid later).

I am really sorry for a late reply, but your work looks very nice.

I was also thinking about the upgrade of Clang, but honestly I have lack of time to do it. This repository remains because I felt it was something useful for someone who wanted to know with Clang in JIT even with older version. However, as you said, the Clang version in which this repository assumed has been quite old.

I am considering that I would like to try it, but I would like you to understand that I can't promise anything about it.

Anyway, your information is quite useful for me and it'll be a first step to update this with the new Clang. I will dig in your code and will try to merge into my product.

Many thanks in advance.