[cfe-commits] [cfe-dev] status of lambda expression implementation

David Blaikie dblaikie at gmail.com
Mon Aug 8 08:13:51 PDT 2011


> I was looking over the clang sources today with some interest. I am curious
> what the current status is of the lambda C++0x code. I did notice a few
> declarations in the Parser.h header that seems to indicate some work is
> going on here.

Yep - just last week Douglas committed (on behalf of John Freeman) an
initial version of support for parsing lambda expressions. You can see
what's supported from the associated test cases what sort of things
are supported.

http://llvm.org/viewvc/llvm-project?view=rev&revision=136876

In the interests of helping the next person who asks this I've
attached a patch to update the status page (
http://clang.llvm.org/cxx_status.html ) & cc'd cfe-commits in the
hopes that someone will commit it. Since we don't have an extensive
set of test cases I'm just flagging this as "some examples work" for
parsing of lambdas with sema/ast/codegen as "not started" (I'm sure
John is working on sema & I'm poking around with it myself, but
nothing is committed yet).

[though I think the C++ status page is in a perpetual state of "out of
date" - I'm pretty sure unified attribute syntax has been added in
some form, for example. Though I don't know what state it's in
exactly]

> One of the things I did notice was that clang appears to do
> most of the parsing using custom code which means one would need to reason
> about the parsing oneself.

Not sure what you're getting at here - I guess you're referring to
clang as a whole, not just the lambda support, & specifically about
the fact that clang doesn't use a parser generator?

I don't know the history behind that decision, but I expect it's
because C++ (& perhaps ObjC/C++) isn't really easy to parse. Most
importantly it's not context-free, so it requires some fairly heavy
work to do things correctly & I doubt any standard parser generators
could handle it.

- David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cxx-status-lambda.patch
Type: application/octet-stream
Size: 513 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110808/aa90b549/attachment.obj>


More information about the cfe-commits mailing list