Description
Noticed while reviewing #468, the following code:
struct cmdline_token_hdr {
struct cmdline_token_ops *ops;
};
struct cmdline_token_ops {
int foo;
};
Makes bindgen believe that cmdline_token_ops
is defined inside cmdline_token_hdr
. The reason is that clang inserts a RecorDecl
cursor before the field declaration, which we parse thinking it is declared as a child.
We should probably treat this as an unresolved type reference, but that has the unexpected side effect of making the inner_items
of a struct/class ResolvedTyperefs
, for which we don't generate code.
I believe generating code for them would be ok because we track all the types seen so far, but worth re-checking.
Unfortunately using this super-naive approach would regress other stuff like:
class A {
public:
int member_a;
class B {
int member_b;
};
};
A::B var;
So I'll have to think a bit harder about how to address this. Probably checking and ignoring non-definitions?