rust-lang / rust-bindgen

Automatically generates Rust FFI bindings to C (and some C++) libraries.
https://rust-lang.github.io/rust-bindgen/
BSD 3-Clause "New" or "Revised" License
4.23k stars 679 forks source link

Blocklist/allowlist based on header #2811

Closed kellda closed 2 months ago

kellda commented 2 months ago

Selecting items to generate based on the header where they're defined would be a convenient alternative to selecting them by name.

Clang's API allows getting the CXSourceLocation for definitions, which then allows to get the source file for it.

@rustbot label enhancement

emilio commented 2 months ago

Isn't --allowlist-file just this?

kellda commented 2 months ago

Yes, it's exactly that. I don't know why I didn't found it, sorry for that.