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

Timothy Akintilo via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 8 19:18:27 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};
----------------
tilobyte wrote:

@zyn0217 unfortunately removing the default initializer breaks a bunch of tests--need to check to confirm but i believe it's due to the check that `LambdaDecl` is `nullptr` here: https://github.com/llvm/llvm-project/blob/d8140f9013f47094a159fd2918128d9252ca3280/clang/lib/Sema/SemaCodeComplete.cpp#L6130

i think the fix would just be setting `LambdaDecl` to `nullptr` everywhere we make an `OverloadCandidate` for a non-lambda, but the `nullptr` default initializer seemed cleaner... let me know if not using a default initializer is preferred.

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


More information about the cfe-commits mailing list