C++11 lambdas

Hello!

A newcomer here wondering what’s the state of things with regards to lambdas support in Clang. I heard there was a gsoc project going on for that this summer, but google doesn’t give me any recent updates on that project’s results yet. Are we going to have lambdas in Clang soon?

Best Regards,
Gevorg

A newcomer here wondering what's the state of things with regards to lambdas
support in Clang. I heard there was a gsoc project going on for that this
summer, but google doesn't give me any recent updates on that project's
results yet. Are we going to have lambdas in Clang soon?

I can't speak for any GSoC work, but one John Freeman contributed the
first step on the road to Lambdas in r136876 (
http://llvm.org/viewvc/llvm-project?view=rev&revision=136876 ) & has
had out for code review the next step (sema + AST:
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20110822/045472.html
(this isn't the entire thread, since it's grouped by week)) though
that hasn't been committed yet & seems to be a little dead in the
water until John or someone else (I might) has time to further refine
it based on Doug's feedback.

- David

Clang can parse lambdas, but most of the real work—semantic analysis, ASTs, template instantiation, code generation—is not there. I don’t expect it to happen “soon”, but I’ll be fairly embarrassed if we don’t have it for the 3.1 release in ~6 months.

  • Doug

Hello,

I may see if I can take a look at this though I am uncertain about certain aspects of the current patch. I.e. how complete is the current parsing? is it finished?

Regards,

Carter.

Forgot to CC the list.

A newcomer here wondering what's the state of things with regards to
lambdas support in Clang. I heard there was a gsoc project going on for
that this summer, but google doesn't give me any recent updates on that
project's results yet. Are we going to have lambdas in Clang soon?

I am still working on it. The latest condition of my work can be seen at GitHub [1].

A student from UT Austin contacted me interested in contributing for a class project, and I gave some pointers, but we do not have regular communication. I do not know if his group committed to working on it.

This is a very high priority for me, but I have been interrupted by more urgent tasks these past two weeks (travel and post-travel catch-up). I expect to return to Clang again this weekend.

The last task I completed was to fix body parsing (properly handling the DeclContext). The next things I'll be working on are moving LambdaExpr to a subtype of CXXConstructExpr, adding LambdaScopeInfo based off of Doug's initial work, and splitting Sema into ActOn* and Build* functions.

Hope this helps,
John

[1] https://github.com/thejohnfreeman/clang-lambdas

Hi John,

Just let me know if you need some help on this- since I do have a bit of spare time. Do you have a URL for the stuff you have on github?

Regards,

Carter.

Just let me know if you need some help on this- since I do have a bit of
spare time.

I would love some help! Tests are always appreciated. Some things on the TODO list are return type deduction, implicit captures (depends on LambdaScopeInfo in progress), visitor templates for RecursiveASTVisitor, StmtReader/Writer/Printer/Whatever, etc., and semantic checks.

Do you have a URL for the stuff you have on github?

Yes, it is here:

https://github.com/thejohnfreeman/clang-lambdas

- John

Thanks John. I will post a patch here when I get the time. Is the code in the repo similar to patch posted on the mailing list?

Yes. If you diff the lambda branch with the master branch, you will get that patch and all of my additional work since. The only thing in that branch that shouldn't be part of the patch is the .gitignore file.

Note that my master branch is a branch off the Clang Git mirror, but it isn't automatically updated, so it is a few weeks behind ToT.

- John

Hi John,

Is there any chance you could post it here?

Regards,

Carter

A patch? See attached.

- John

lambda-wip.patch (41.8 KB)

Thanks John.