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

Doug Gregor dgregor at apple.com
Mon Sep 30 22:05:49 PDT 2013



================
Comment at: lib/Sema/SemaTemplateInstantiate.cpp:922
@@ +921,3 @@
+      // I think Doug tried to explain why this link is done, but
+      // I was hoping to get a little more clarity.
+      // If a lambda is undergoing transformation for instance:
----------------
For the case where we have a non-generic lambda within a template, setInstantiationOfMemberFunction() creates a link between the operator() and its instantiations. See FunctionDecl::getInstantiatedFromMemberFunction() for an example.

================
Comment at: lib/Sema/SemaTemplateInstantiate.cpp:951
@@ +950,3 @@
+                                                          Innermost.size()),
+                                              /*InsertPos=*/0);
+#endif
----------------
This is turning the call operator into a specialization of the old call operator template, which isn't quite right. We want to establish that NewCallOperatorTemplate was instantiated from the member template OldCallOperatorTemplate using RedeclarableTemplateDecl::setInstantiatedFromMemberTemplate(). See RedeclarableTemplateDecl::getInstantiatedFromMemberTemplate() for an example of how this method works.

================
Comment at: lib/Sema/TreeTransform.h:600
@@ +599,3 @@
+    // FVQUESTION: Currently not implemented - Check with Doug/Richard
+    // what sort of semantics we want the default one to have?
+
----------------
We should probably just return TPL here.

================
Comment at: lib/Sema/TreeTransform.h:4580
@@ +4579,3 @@
+  //};  
+  if (!T->isInstantiationDependentType() && !T->isVariablyModifiedType()) {
+    DecltypeTypeLoc NewTL = TLB.push<DecltypeTypeLoc>(TL.getType());
----------------
The T->isVariablyModifiedType() check doesn't make sense here.

================
Comment at: lib/Sema/TreeTransform.h:8316
@@ +8315,3 @@
+  LSI->CallOperator = NewCallOperator;
+  // Fix the Decl Contexts of the parameters within the cal op function 
+  // prototype.
----------------
Typo "cal".


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



More information about the cfe-commits mailing list