Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LLVM version #43

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Update LLVM version #43

wants to merge 20 commits into from

Conversation

robfors
Copy link

@robfors robfors commented Apr 8, 2023

I was struggling to use this gem as the target LLVM version was too old and it was failing when I tried to to use a recent version of LLVM.

I updated it to use the dynamic library of llvm-15. It would be nice to let this gem support whatever version of LLVM is installed but I don't think the ffi gem can currently support that, so I locked it to llvm-15.

I refactored the code a bunch to try to figure out how it worked and then diagnose why it was not working with the recent version of LLVM. I managed to get it working again.
I found out that the Clang API should have been backward compatible from llvm-3.5 so I am not exactly sure what I did to fix the gem but it was working by the time I finished refactoring it.

I was not able to run most of the tests as those dynamic libraries are also too old to easily install.
I was able to get it to successfully regenerate its own Clang binding file. The "Update llvm/clang version" commit shows the changes to this file. I don't see any unexpected differences to it, just some things that have been cleaned up or added to the Clang header files since llvm-3.5. I was then able to use the new bindings to regenerate the file again and confirmed no changes to it this time.

I also added a quickstart guide to help people install LLVM.

Let me know what you think.

@robfors
Copy link
Author

robfors commented Sep 10, 2023

Hey @neelance, is this something you would want to merge?

I ended up cleaning and restructuring the code a lot before I got the gem working so this PR has ended up being quite large. If you think this PR changes too much I can just fork the gem.

It was kind of a chicken and egg problem because I assumed I could not get the gem working until I updated its Clang FFI bindings to be compatible with a current version of Clang, but I needed the gem working to regenerate the bindings.
My plan was to refactor the code until I understood how the bindings got generated then update them manually.
Strangely enough, it eventually started working without any change to the bindings as it turns out the Clang API was backward compatible, so maybe I unknowingly fixed a bug while refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant