Hi all!
I am iterating through the friends of a CXXRecordDecl (via friend_iterator)
but I cannot find a way to access the actual definitions of these friends if
they exist (CXXRecordDecl if friend is a class or FunctionDecl if friend is
a function).
Any suggestions ?
Thanks! 
FriendDecl::getFriendDecl returns a NamedDecl that you can cast to appropriate subclass. You’ll have to use FriendDecl::getFriendType if you’re interested in friend declaratons that were introduced in c++11
struct A;
struct B {
friend A; // this doesn’t forward declare A as opposed to ‘friend struct A’
};
Thank you Nikola,
I have noticed that FriendDecl::getFriendDecl returns NULL when friend is a
struct / class while FriendDecl::getFriendType returns NULL when friend is a
function. Is this a correct way to identify the kind of the friend
(struct/class or function) ?
Comment for getFriendType says: “If this friend declaration names an (untemplated but possibly dependent) type, return the type; otherwise return null. This is used for elaborated-type-specifiers and, in C++0x, for arbitrary friend type declarations.”
Elaborated type would be ‘friend struct A’, C++0x case is the one I gave in previous email. So yes that’s the correct way to differentiate them.