I’m using .td
to define my dialect attribute classes. I have two attr A
and B
. Attr A
has a member function (extra declaration) that returns SmallVector<B>
. The compilation of this header file fails because the definition of B
is after A
and therefore throws an “incomplete type” error. Swapping A
and B
in .td file does not change the order of generated A
and B
in .h.inc
file.
class A;
class B;
class A : public AttrBase {
ArrayRef<B> foo(); // ArrayRef works because it's only a pointer of B
SmallVector<B> bar(); // Compile error: SmallVector needs to know sizeof(B)
};
class B : public AttrBase {
};
Any suggestion how I should fix this? Thanks in advance!
Qingyi