[all-commits] [llvm/llvm-project] 6b104e: Implement Lambda Conversion Operators for All CCs ...

Erich Keane via All-commits all-commits at lists.llvm.org
Thu Nov 5 07:26:16 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6b104ea4b4630c2fa841c6d5f7c7a69b08d31979
      https://github.com/llvm/llvm-project/commit/6b104ea4b4630c2fa841c6d5f7c7a69b08d31979
  Author: Erich Keane <erich.keane at intel.com>
  Date:   2020-11-05 (Thu, 05 Nov 2020)

  Changed paths:
    M clang/lib/Sema/SemaLambda.cpp
    M clang/test/CodeGenCXX/lambda-conversion-op-cc.cpp

  Log Message:
  -----------
  Implement Lambda Conversion Operators for All CCs for MSVC.

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.

Differential Revision: https://reviews.llvm.org/D90634




More information about the All-commits mailing list