rust-bindgen
rust-bindgen copied to clipboard
Generate opaque type for template param dependent bit field width
libclang's API does not provide a straightforward way to check for this, and calling clang_getFieldDeclBitWidth is actively unsafe in this case. See https://github.com/llvm/llvm-project/issues/56644
We probably can't generate reasonable bindings for such a type, so make the binding opaque.
Ideally libclang would report if the bit width could not be evaluated. Unfortunately making such a change would mean bumping the minimum libclang version from 6.0 to 15.0.
Instead, add logic to traverse the AST subtree starting from the field's bit width specifier looking for template parameters. If we find one, we make the resulting type opaque
Workaround for https://github.com/rust-lang/rust-bindgen/issues/2239
Not sure what happened here... I guess I accidentally changed my master branch then it auto-merged because there were no changes?