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

Report mods in `ParseCallbacks::new_item_found`

Open adetaylor opened this issue 10 months ago • 1 comments

Report mods in callbacks, and item parentage.

This makes two complementary improvements to the ParseCallbacks. The first is that Mods are now announced, as a new type of DiscoveredItem. The second is that the parentage of each item is announced. The parent of an item is often a mod (i.e. a C++ namespace) but not necessarily - it might be a struct within a struct, or similar.

The reported information here is dependent on two pre-existing bindgen options:

  • whether to report C++ namespaces at all
  • whether to report inline namespaces conservatively.

For that reason, the test suite gains two new tests.

Builds on top of #3141.

adetaylor avatar Feb 21 '25 14:02 adetaylor

I'm starting to get a bit concerned about the overhead of building all this info for callbacks unconditionally, but we could optimize in the future by allowing callbacks to opt out of some of this or so.

emilio avatar Apr 04 '25 13:04 emilio