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

Doug Gregor dgregor at apple.com
Tue Oct 22 09:53:26 PDT 2013


  Just the one comment about transforming template parameter lists, but otherwise this LGTM.


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

================
Comment at: lib/Sema/TreeTransform.h:8299
@@ +8298,3 @@
+  if (OrigTPL) 
+    NewTPL = getDerived().TransformTemplateParameterList(OrigTPL);
+  LSI->GLTemplateParameterList = NewTPL;
----------------
Don't we need to check whether NewTPL null after this, in case the transformation of the template parameter list failed?

================
Comment at: lib/Sema/TreeTransform.h:8346
@@ +8345,3 @@
+      // template is specialized and the entire lambda expression has to be
+      // transformed. Without this FindInstantiatedDecl causes an assertion.
+      // template<class T> void foo(T t) {
----------------
Please remove the last sentence; we should describe why something is correct to do, not which bug we're avoiding.


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



More information about the cfe-commits mailing list