On Aug 26, 2010, at 12:24 PM, Benoit Belley wrote:
> I have modified the RecursiveASTVisitor so that it can now optionally visit 
> every template specialization (class and fucntion templates, implicit and 
> explicit instantiations). 
> 
> By default this visitor will not recurse in template specializations since 
> the instatiated class isn’t written in the source code anywhere. This 
> behavior can now be changed by calling 
> setVisitingTemplateSpecializations(true) before starting the traversal.

The idiomatic way of doing this with the CRTP is to call methods on the derived 
class instead of consulting flags.

That is, TRAVERSE_DECL(ClassTemplateDecl) should 
TRY_TO(TraverseImplicitInstantantiations(D)), TraverseImplicitInstantiations 
should check getDerived().shouldTraverseImplicitInstantiations() before 
proceeding, and shouldTraverseImplicitInstantiations() should return false 
(which you would override in your subclass, of course).

The way to check whether a function template specialization is an implicit 
instantiation is to consult 
getTemplateSpecializationInfo()->getTemplateSpecializationKind().  For a class 
template specialization, it's just getSpecializationKind().

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

Reply via email to