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

Yang Chen chenyang at cs.utah.edu
Tue May 29 23:42:06 PDT 2012


Hi Richard,

On 5/29/12 6:41 PM, Richard Smith wrote:
> Hi,
>
> On Sun, May 27, 2012 at 6:29 PM, Yang Chen <chenyang at cs.utah.edu 
> <mailto: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.

Fixed.

>     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).

Thanks for the info. I attached a new patch which includes two more test 
cases for TemplateTemplateParmDecl and NonTypeTemplateParmDecl.

- Yang

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120530/2ffd762f/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: RAV.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120530/2ffd762f/attachment.ksh>


More information about the cfe-commits mailing list