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

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 6 08:33:22 PDT 2024


================
@@ -4022,7 +4022,10 @@ CodeCompleteConsumer::OverloadCandidate::CreateSignatureString(
 
     std::string Name;
     llvm::raw_string_ostream OS(Name);
-    FDecl->getDeclName().print(OS, Policy);
+    auto const DeclName = (getKind() == CK_Lambda)
----------------
zyn0217 wrote:

This isn't the place for diagnostics. I think we're actually printing the DeclarationName for the function signature help, so we don't end up with an `operator()` in the lambda case.

<img width="314" alt="image" src="https://github.com/user-attachments/assets/006ac25d-b7cb-4895-b340-d9e5f9b05a37">

(This is what it looks like for lambdas currently)

I hope this could properly fall back to the previous logic if the lambda expression weren't declared with a name.

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


More information about the cfe-commits mailing list