[cfe-commits] [Patch] - Avoid duplicated visits to default arguments for class templates

Richard Smith richard at metafoo.co.uk
Tue May 29 17:41:39 PDT 2012


On Sun, May 27, 2012 at 6:29 PM, Yang Chen <chenyang at cs.utah.edu> wrote:

> Seems RecursiveASTVisitor has a bug which could cause duplicated visits to
> default arguments for a class template. For example, given the code below:
> class X;
> template<class T = X> class Y;
> template<class T> class Y {};
> The default argument 'X' will be visited twice. The attached patch fixed
> the problem.

Thanks, the patch looks good. We should also handle NonTypeTemplateParmDecl
in the same way.

> I also attached a small testcase. Thanks.

(It's conventional to put the code and test changes in the same patch
file.) Tests for the other two flavours of template parameters would be
great (you will probably need to add new ExpectedLocationVisitor subclasses
to RecursiveASTVisitorTest to test those).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120529/d5f0df76/attachment.html>

More information about the cfe-commits mailing list