[PATCH] Generic Lambdas: A first & second step

Faisal Vali faisalv at yahoo.com
Sun Sep 8 21:01:19 PDT 2013


  Patch Notes:
    - Incorporated Dougs feedback and removed the redundant C++1y checks.
    - separated Lambda Utility functions into ASTLambda.h and SemaLambda.h
    - implemented lambda captures based on core-23966 discussion [and pending paper] (modulo bugs)
    - implemented the conversion to pointer-to-function for generic lambdas (modulo bugs)

  Also tried to fix the following bugs:
    - using arrays in templates when the index is dependent.
      template<class T> void foo(T Index) {
        int array[5]{};
        int sum = 0;
        sum += array[Index];// This causes an assertion failure - so added a check for type dependence in IgnoredValueConversions
      }
    - In regards to delayed template parsing:
       - fix return type deduction by forcing parsing of the template even in delayed parsing mode.
       - explicit member function specializations in ms-extensions mode.


  TODOS:
    - 'this' capturing in NSDMI and potentially dependent contexts
    - non-trivial nested variadics aren't fully supported yet:
       auto foo3() {
         auto K =  [](auto ... OuterArgs) {
           variadic_fun([=](auto ... Is) {
              decltype(OuterArgs) OA = OuterArgs;
              return 0;
              }(5)...);
           return 0;
         };

         auto M = K('a', ' ', 1, " -- ", 3.14);
         return 0;
       }
      - what else ???

  Will appreciate feedback - since I'm sure there are certain things that should be done differently ;)

Hi rsmith, doug.gregor, eli.friedman,

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

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D1174?vs=3563&id=4131#toc

Files:
  include/clang/AST/ASTContext.h
  include/clang/AST/ASTLambda.h
  include/clang/AST/DeclCXX.h
  include/clang/AST/ExprCXX.h
  include/clang/AST/Type.h
  include/clang/Basic/DiagnosticSemaKinds.td
  include/clang/Sema/DeclSpec.h
  include/clang/Sema/ScopeInfo.h
  include/clang/Sema/Sema.h
  include/clang/Sema/SemaLambda.h
  lib/AST/ASTContext.cpp
  lib/AST/ASTImporter.cpp
  lib/AST/Decl.cpp
  lib/AST/DeclCXX.cpp
  lib/AST/ExprCXX.cpp
  lib/AST/Type.cpp
  lib/CodeGen/CGClass.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseExprCXX.cpp
  lib/Parse/Parser.cpp
  lib/Parse/ParseTemplate.cpp
  lib/Sema/Sema.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaLambda.cpp
  lib/Sema/SemaOverload.cpp
  lib/Sema/SemaStmt.cpp
  lib/Sema/SemaTemplateDeduction.cpp
  lib/Sema/SemaTemplateInstantiate.cpp
  lib/Sema/SemaTemplateInstantiateDecl.cpp
  lib/Sema/SemaType.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReader.cpp
  lib/Serialization/ASTReaderDecl.cpp
  lib/Serialization/ASTWriter.cpp
  test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3-generic-lambda-1y.cpp
  test/CXX/expr/expr.prim/expr.prim.lambda/generic-lambda-capturing.cpp
  test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
  test/CXX/expr/expr.prim/expr.prim.lambda/p4-1y.cpp
  test/CXX/expr/expr.prim/expr.prim.lambda/p4.cpp
  test/CXX/expr/expr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp
  test/Parser/DelayedTemplateParsing.cpp
  test/PCH/cxx1y-lambdas.mm
  test/SemaCXX/cxx1y-deduced-return-type.cpp
  test/SemaCXX/cxx1y-generic-lambdas.cpp
  test/SemaCXX/lambda-expressions.cpp
  test/SemaTemplate/ms-function-specialization-class-scope.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1174.4.patch
Type: text/x-patch
Size: 224747 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130908/14c7deaa/attachment.bin>


More information about the cfe-commits mailing list