r191453 - Implement a rudimentary form of generic lambdas.

Nick Lewycky nlewycky at google.com
Thu Sep 26 13:34:54 PDT 2013


On 26 September 2013 12:54, Faisal Vali <faisalv at yahoo.com> wrote:

> Author: faisalv
> Date: Thu Sep 26 14:54:12 2013
> New Revision: 191453
>
> URL: http://llvm.org/viewvc/llvm-project?rev=191453&view=rev
> Log:
> Implement a rudimentary form of generic lambdas.
>
> Specifically, the following features are not included in this commit:
>   - any sort of capturing within generic lambdas
>   - generic lambdas within template functions and nested
>     within other generic lambdas
>   - conversion operator for captureless lambdas
>   - ensuring all visitors are generic lambda aware
>   (Although I have gotten some useful feedback on my patches of the above
> and will be incorporating that as I submit those patches for commit)
>

[...]


> Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=191453&r1=191452&r2=191453&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
> +++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Thu Sep 26 14:54:12 2013
> @@ -10,7 +10,7 @@
>  // This file implements the Expression parsing implementation for C++.
>  //
>
>  //===----------------------------------------------------------------------===//
> -
> +#include "clang/AST/DeclTemplate.h"
>  #include "clang/Parse/Parser.h"
>  #include "RAIIObjectsForParser.h"
>  #include "clang/Basic/PrettyStackTrace.h"
> @@ -21,6 +21,7 @@
>  #include "clang/Sema/Scope.h"
>  #include "llvm/Support/ErrorHandling.h"
>
> +
>  using namespace clang;
>
>  static int SelectDigraphErrorMessage(tok::TokenKind Kind) {
> @@ -908,12 +909,16 @@ ExprResult Parser::ParseLambdaExpression
>    PrettyStackTraceLoc CrashInfo(PP.getSourceManager(), LambdaBeginLoc,
>                                  "lambda expression parsing");
>
> +
> +
>    // FIXME: Call into Actions to add any init-capture declarations to the
>    // scope while parsing the lambda-declarator and compound-statement.
>
>    // Parse lambda-declarator[opt].
>    DeclSpec DS(AttrFactory);
>    Declarator D(DS, Declarator::LambdaExprContext);
> +  TemplateParameterDepthRAII
> CurTemplateDepthTracker(TemplateParameterDepth);
> +  Actions.PushLambdaScope();
>
>    if (Tok.is(tok::l_paren)) {
>      ParseScope PrototypeScope(this,
> @@ -931,9 +936,16 @@ ExprResult Parser::ParseLambdaExpression
>      SmallVector<DeclaratorChunk::ParamInfo, 16> ParamInfo;
>      SourceLocation EllipsisLoc;
>
> -    if (Tok.isNot(tok::r_paren))
> +
> +    if (Tok.isNot(tok::r_paren)) {
> +      sema::LambdaScopeInfo *LSI = Actions.getCurLambda();
>

tools/**clang/lib/Parse/ParseExprCXX.**cpp:943:30: error: unused variable
'LSI' [-Werror,-Wunused-variable]
      sema::LambdaScopeInfo *LSI = Actions.getCurLambda();
                             ^
1 error generated.

Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130926/a5eb1c38/attachment.html>


More information about the cfe-commits mailing list