[PATCH] Implement transformations of non-capturing nested lambdas.

Faisal Vali faisalv at yahoo.com
Tue Oct 22 13:47:03 PDT 2013


  yay! thanks for taking the time :)


================
Comment at: lib/Sema/TreeTransform.h:8299
@@ +8298,3 @@
+  if (OrigTPL) 
+    NewTPL = getDerived().TransformTemplateParameterList(OrigTPL);
+  LSI->GLTemplateParameterList = NewTPL;
----------------
Doug Gregor wrote:
> Don't we need to check whether NewTPL null after this, in case the transformation of the template parameter list failed?
Not really, since whether it is null or not is checked by the Sema::lambda clan.  But now that you draw my attention to it, I guess I could replace these 5 lines with this one:
LSI->GLTemplateParameterList = getDerived().TransformTemplateParameterList(E->getTemplateParameterList());

================
Comment at: lib/Sema/SemaTemplateInstantiate.cpp:933
@@ +932,3 @@
+      //  - In the generic lambda case, we set the NewTemplate to be considered
+      //    an "instantiation" of the OldTemplate.
+      // See the documentation and use of get/setInstantiationOfMemberFunction
----------------
Doug Gregor wrote:
> I love comments, but I don't think a complete discussion of how primary templates and specializations are wired together is necessary here. This last bullet is the important part for what we're doing here.
So I should replace the entire block above with:
//  In the non-generic lambda case we set the NewCallOperator to be considered
//  an instantiation of the OldCallOperator.
//  In the generic lambda case, we set the NewTemplate to be considered 
//  an "instantiation" of the OldTemplate.
 



http://llvm-reviews.chandlerc.com/D1784



More information about the cfe-commits mailing list