[cfe-dev] Friend Declaration in clang

madil90 madil90 at gmail.com
Mon Jan 21 04:30:59 PST 2013


Hi,
    My goal is to find out whether every c++ class declaration in a file has
an overloaded "<<" stream operator. While traversing the AST, whenever I
encounter a CXXRecordDecl, I want to find out whether that recorddecl has an
overloaded operator with the spelling "<<". The problem is that the "<<"
operator is always declared as a friend method. When I traverse frienddecl,
I am unable to obtain a CXXMethodDecl from it (to check whether it's an
operator). Can you please tell me how can friend operators be detected?
consider the following code as an example.

class A
{
friend ostream &operator<<(ostream& out, A A1){}
};

Regards,
Adil



--
View this message in context: http://clang-developers.42468.n3.nabble.com/Friend-Declaration-in-clang-tp4029918.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list