rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

Making ir publicly accessible

Open branchseer opened this issue 3 years ago • 1 comments

Hi, I'd like to use bindgen to parse headers into ir without the codegen part, and then with ir I can generate bindings in other languages.

There is --emit-ir, but that's in debug format which is not easily readable by machines.

I think we can make the ir module public (may need some cleanup though), and/or add a --emit-ir-jsonoption to emit ir in json represetantion, something like:

{
   "kind": "function",
   "name": "foo",
   "mangledName": "_foo",
   "signature": {
      "returnType": ...,
      "params": [ ... ]
   },
}

I'd be happy to work on a PR, if such change doesn't fall out of bindgen's scope.

branchseer avatar Apr 30 '22 17:04 branchseer

I'm not sure how I feel about it. On one hand it makes breaking changes much more common, on the other hand it doesn't change all that often anymore I guess. So it might be worth doing.

Sorry for the lag getting back to this.

emilio avatar Jun 05 '22 17:06 emilio