On Aug 31, 2010, at 2:57 PM, Benoit Belley wrote:
> I have made good progress today with the help of your comments.

Glad to hear it!

> Visiting the class template definition while skipping the re-declarations 
> turns out to be not so obvious. FunctionDecl and VarDecl have 
> isThisDeclarationADefiniton(). RecordDecl has getDefintion()... But, 
> ClassTemplateDecl has none of this. I have found that the following trick 
> seems to work in practice:
> 
>    ClassTemplateDecl* D = ...;
>    CXXRecordDecl* TemplDecl = D->getTemplatedDecl();
>    if (TemplDecl) {
>      if (CXXRecordDecl* TemplDef = TemplDecl->getDefinition()) {
>        if (TemplDecl == TemplDef) {
>          TRY_TO(TraverseImplicitClassInstantiations(D));
>        }
>      }
>    }
> 
> Is this the correct approach ?

This works, but it's sufficient to call isDefinition() on the templated decl.  
I've also just added isThisDeclarationADefinition() overloads to the template 
decls, so it should be even easier. :)

John.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to