[PATCH] Simple Generic Lambdas: Chicago Reversion

Doug Gregor dgregor at apple.com
Wed Sep 25 12:32:32 PDT 2013


  There are a few places where there is more return-type deduction code to be separated out, and one or two trivial issues, but with those tweaks this looks like it can go in now.


================
Comment at: include/clang/Sema/ScopeInfo.h:633
@@ +632,3 @@
+
+  TemplateParameterList *GLTemplateParameterList;
+  LambdaScopeInfo(DiagnosticsEngine &Diag)
----------------
Weird spacing above/below this data member. Can you add a comment as well?

================
Comment at: include/clang/AST/ASTLambda.h:23
@@ +22,3 @@
+namespace clang {
+inline const char *getLambdaStaticInvokerName() {
+  return "__invoke";
----------------
StringRef and out-of-line definition, please.

================
Comment at: include/clang/AST/ASTLambda.h:29
@@ +28,3 @@
+inline bool isLambdaCallOperator(const CXXMethodDecl *MD) {
+  if (!MD) return false;
+  const CXXRecordDecl *LambdaClass = MD->getParent();
----------------
Seems odd to have a NULL check here at all.

================
Comment at: include/clang/AST/ASTLambda.h:36
@@ +35,3 @@
+inline bool isGenericLambdaCallOperatorSpecialization(CXXMethodDecl *MD) {
+  if (MD) {
+    CXXRecordDecl *LambdaClass = MD->getParent();
----------------
Seems odd to have a NULL check here at all.

================
Comment at: include/clang/AST/ASTLambda.h:47
@@ +46,3 @@
+inline bool isGenericLambdaCallOperatorSpecialization(Decl *D) {
+  return isGenericLambdaCallOperatorSpecialization(
+                                dyn_cast<CXXMethodDecl>(D));
----------------
... but this would need the NULL check...

================
Comment at: lib/Sema/SemaLambda.cpp:600
@@ +599,3 @@
+    // For C++1y, use the new return type deduction machinery, by imagining
+    // 'auto' if no trailing return type.
+    QualType DefaultTypeForNoTrailingReturn = getLangOpts().CPlusPlus1y ?
----------------
This should be separated out, no?

================
Comment at: lib/Sema/SemaLambda.cpp:625
@@ -574,1 +624,3 @@
+    // (through ConvertDeclSpecToType) which allows us to support both
+    // C++11 and C++1y return type deduction semantics.
     MethodTyInfo = GetTypeForDeclarator(ParamInfo, CurScope);
----------------
Also looks like it should be separated out.

================
Comment at: lib/Sema/SemaLambda.cpp:1070
@@ -1020,2 +1069,3 @@
+    if (LSI->HasImplicitReturnType && !getLangOpts().CPlusPlus1y) {
       deduceClosureReturnType(*LSI);
 
----------------
Also should be separated out?

================
Comment at: lib/Sema/SemaStmt.cpp:2514
@@ -2496,1 +2513,3 @@
+  if (CurCap->HasImplicitReturnType && 
+                            (!LambdaSI || !getLangOpts().CPlusPlus1y)) {
     if (RetValExp && !isa<InitListExpr>(RetValExp)) {
----------------
More return type stuff that should have been separated out.

================
Comment at: lib/Sema/SemaStmt.cpp:2707
@@ +2706,3 @@
+      LambdaScopeInfo *const LambdaSI = getCurLambda();
+      if (LambdaSI && LambdaSI->HasImplicitReturnType) {
+        Diag(ReturnLoc,
----------------
More return types :)

================
Comment at: lib/Sema/SemaType.cpp:773
@@ -768,1 +772,3 @@
+               declarator.getContext() == Declarator::LambdaExprContext 
+                  ? Context.getAutoDeductType() : Context.DependentTy;
       break;
----------------
More return types.


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



More information about the cfe-commits mailing list