[cfe-dev] Visiting out of line template method definitions

John McCall rjmccall at apple.com
Fri Oct 19 11:49:09 PDT 2012


On Oct 19, 2012, at 4:31 AM, Konstantin Tokarev wrote:
> I'd like to visit out of line declarations of template methods to set up one-one relationships between TemplateTypeParmDecl's in method definition and in "base" ClassTemplateDecl.
> 
> Is it possible to do this? I haven't found a way to find method declarations for ClassTemplateDecl,

All the content of the class is kept on the "pattern" declaration, getTemplatedDecl(), which otherwise looks like a normal CXXRecordDecl.

> and also haven't found a way to determine if CXXRecordDecl is out of line template method definition of certain ClassTemplateDecl.

You mean if a CXXMethodDecl is an out-of-line method declaration?  isOutOfLine() should work;  alternatively, if you found the declaration by walking the translation unit, it's obvious out of line.

John.



More information about the cfe-dev mailing list