rust-lang / rust-lang/rust-bindgen
Making ir publicly accessible
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the existing --emit-ir entry point and the ir module to understand how the current debug representation is produced. Compare the two proposed directions—making ir public or adding JSON emission—and define the supported machine-readable interface, including its scope and cleanup needs. Done means the chosen interface is usable for parsing bindgen IR without invoking code generation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100