[cfe-commits] r150783 - in /cfe/trunk: include/clang/AST/DeclCXX.h lib/AST/DeclCXX.cpp lib/CodeGen/CGClass.cpp lib/CodeGen/CodeGenFunction.cpp lib/CodeGen/CodeGenFunction.h lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaLambda.cpp test/CodeGenCXX/lambda-e
Eli Friedman
eli.friedman at gmail.com
Fri Feb 17 17:31:59 PST 2012
On Thu, Feb 16, 2012 at 7:02 PM, Douglas Gregor <dgregor at apple.com> wrote:
> Author: dgregor
> Date: Thu Feb 16 21:02:34 2012
> New Revision: 150783
>
> URL: http://llvm.org/viewvc/llvm-project?rev=150783&view=rev
> Log:
> Rework the Sema/AST/IRgen dance for the lambda closure type's
> conversion to function pointer. Rather than having IRgen synthesize
> the body of this function, we instead introduce a static member
> function "__invoke" with the same signature as the lambda's
> operator() in the AST. Sema then generates a body for the conversion
> to function pointer which simply returns the address of __invoke. This
> approach makes it easier to evaluate a call to the conversion function
> as a constant, makes the linkage of the __invoke function follow the
> normal rules for member functions, and may make life easier down the
> road if we ever want to constexpr'ify some of lambdas.
>
> Note that IR generation is responsible for filling in the body of
> __invoke (Sema just adds a dummy body), because the body can't
> generally be expressed in C++.
>
> Eli, please review!
I don't see any issues.
-Eli
More information about the cfe-commits
mailing list