cursor equality with templates

Say I have a class, with a member declaration:

class A { void foo() {} };

and I get a cursor to it. I then find a reference to it, say:

int main() { A a; a.foo(); }

The return value of clang_getCursorReferenced() is then “equal” to the declaration cursor. By looking at source, it appears that “equal” here means that they’re of the same kind, and the fields data[3] are all equal.

Things change when A is a class template, however:

template
class A { void foo() {} };

Say I have a couple references to this method, now, say:

int main() { A a; a.foo(); A b; b.foo(); }

Now the return values of clang_getCursorReferenced() are no longer “equal” to the declaration cursor. They appears to be different via the value of CXCursor::data[0], which seems to change for each instantiation of the template.

Is there a way to connect the reference cursors back to the member declaration cursor? Moreover, is there a way to do it through the python bindings?

My goal is to find all uses of A::foo(), regardless of T.

Thanks for any help.

Bob Anderson