[all-commits] [llvm/llvm-project] e9c9db: PR58819: Correct linkage and mangling of lambdas i...

David Blaikie via All-commits all-commits at lists.llvm.org
Mon Apr 3 21:58:07 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e9c9db34a9b04706937e9dd764d1d97ca84337b6
      https://github.com/llvm/llvm-project/commit/e9c9db34a9b04706937e9dd764d1d97ca84337b6
  Author: David Blaikie <dblaikie at gmail.com>
  Date:   2023-04-04 (Tue, 04 Apr 2023)

  Changed paths:
    M clang/lib/Sema/SemaLambda.cpp
    M clang/test/CodeGenCXX/mangle-lambdas.cpp

  Log Message:
  -----------
  PR58819: Correct linkage and mangling of lambdas in inline static member initializers

https://llvm.org/pr58819 - clang is giving an externally visible lambda in a static data member internal linkage and the wrong linkage name.

Looks like we should be classifying this case the same as a non-static data member, so far as I can tell from the ABI docs and template examples (seems like the non-template inline-defined case should be the same).

This is a change in ABI, but not sure it qualifies as an ABI break as far as Apple and Sony are concerned - do you folks want this change? (it should fix the example in the bug where a static member in such a lambda ends up bifurcated, and I don't /think/ it'll break existing code since the symbol was previously internal anyway)

Looks like GCC has got this mangling slightly wrong (so we'd still end up with GCC+Clang bifurcation of the local static in the lambda, function address inequality, etc) in that they miss the variable name in the mangling in the non-template case. GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107741

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




More information about the All-commits mailing list