<html>
<head></head>
<body>
<p>Hi,</p>
<p>I built a matcher to retrieve a copy constructor with the form:</p>
<p>X(const X& copy) { ...}</p>
<p>DeclarationMatcher CC =<br/>
methodDecl(<br /> isCopyAssignmentOperator(), has(compoundStmt(has(stmt()))),<br/>
ofClass(recordDecl(hasCopyAssignmentWithConstParam())) <br /> ).bind("CC");</p>
<p>Everything seemed to work fine, but something strange has happened today. I was testing the matcher with a program containing the next class in the header file:</p>
<p>class StrPair <br />{ <br />public: <br /> <br /> StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {} <br /> ~StrPair(); <br /> <br /> void Set( char* start, char* end, int flags ) { <br /> Reset(); <br /> _start = start; <br /> _end = end; <br /> _flags = flags; <br /> } <br /> <br /> const char* GetStr(); <br /> <br /> bool Empty() const { <br /> return _start == _end; <br /> } <br /> <br /> void SetInternedStr( const char* str ) { <br /> Reset(); <br /> _start = const_cast<char*>(str); <br /> } <br /> <br /> void SetStr( const char* str, int flags=0 ); <br /> <br /> char* ParseText( char* in, const char* endTag, int strFlags ); <br /> char* ParseName( char* in ); <br /> <br />private: <br /> void Reset(); <br /> void CollapseWhitespace(); <br /> <br /> // After parsing, if *_end != 0, it can be set to zero. <br /> int _flags; <br /> char* _start; <br /> char* _end; <br />};</p>
<br/>
<p>To my surprise, my matcher retrieved the name of the class:</p>
<p>class <strong>StrPair</strong><br/>
{<br/>
...</p>
<p>This program has a .cpp file defining some of the methods of the class as well, but only the header file is changed, so I think the .cpp file is not the problem.</p>
<p>However, to test what was happening, I put the class in another file with some other classes and the same matcher didn't make the change that I comment above.</p>
<p>What can be happening here? The class StrPair doesn't even have a copy constructor...</p>
<p>Thanks,</p>
<p>Pedro.</p>
</body>
</html>