If you're stuck figuring out the right C++ API call to use with LLVM, you can dynamically generate example code here! https://ellcc.org/blog/?page_id=340
Trying to update bfc for recent LLVM, and reviewing the Rust docs to see what I need to update. Not sure if I should be complimented or concerned that bfc is suggested as an API example! https://crates.io/crates/llvm-sys