[clang] [clang-tools-extra] [clangd] show lambda name instead of operator() in signature help (PR #101857)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 9 06:19:47 PDT 2024


================
@@ -876,6 +876,11 @@ class Sema;
     /// function pointer or reference (C++ [over.call.object]).
     FunctionDecl *Function;
 
+    /// LambdaName - When the OverloadCandidate is for a
+    /// lambda's operator(), points to the declaration of
+    /// the lambda variable.
+    VarDecl *LambdaName{nullptr};
----------------
erichkeane wrote:

The pack lambda I was thinking about was something like:

```
template <typename ... Lambdas>
void bar(Lambdas... Ls) {
  Ls()...;
}

void caller() {
bar([]{return 1;}, []{return 1.1;}, []{return "1";}); // where each are mildly different/etc

```

It seems it would be weird to me to print 'Ls' for each, since as they are distinct, particularly if that causes a diagnostic.

https://github.com/llvm/llvm-project/pull/101857


More information about the cfe-commits mailing list