[PATCH] D90634: Implement Lambda Conversion Operators for All CCs for MSVC.

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 2 11:11:16 PST 2020


erichkeane created this revision.
erichkeane added reviewers: rjmccall, aaron.ballman.
Herald added subscribers: mgrang, kristof.beyls.
erichkeane requested review of this revision.

As described here:
https://devblogs.microsoft.com/oldnewthing/20150220-00/?p=44623

In order to allow Lambdas to be used with traditional Win32 APIs, they
emit a conversion function for (what Raymond Chen claims is all) a
number of the calling conventions.  Through experimentation, we
discovered that the list isn't quite 'all'.

This patch implements this by taking the list of conversions that MSVC
emits (across 'all' architectures, I don't see any CCs on ARM), then
emits them if they are supported by the current target.

However, we also add 3 other options (which may be duplicates):
free-function, member-function, and operator() calling conventions.  We
do this because we have an extension where we generate both free and
member for these cases so th at people specifying a calling convention
on the lambda will have the expected behavior when specifying one of
those two.

MSVC doesn't seem to permit specifying calling-convention on lambdas,
but we do, so we need to make sure those are emitted as well. We do this
so that clang-only conventions are supported if the user specifies them.


https://reviews.llvm.org/D90634

Files:
  clang/lib/Sema/SemaLambda.cpp
  clang/test/CodeGenCXX/lambda-conversion-op-cc.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90634.302338.patch
Type: text/x-patch
Size: 6658 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201102/34a2f02c/attachment.bin>


More information about the cfe-commits mailing list