[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
Fri Sep 6 06:49:11 PDT 2024


================
@@ -6292,11 +6298,16 @@ SemaCodeCompletion::ProduceCallSignatureHelp(Expr *Fn, ArrayRef<Expr *> Args,
         SmallVector<Expr *, 12> ArgExprs(1, NakedFn);
         ArgExprs.append(ArgsWithoutDependentTypes.begin(),
                         ArgsWithoutDependentTypes.end());
+        auto *const LambdaName =
+            DC->isLambda() ? cast<VarDecl>(NakedFn->getReferencedDeclOfCallee())
----------------
erichkeane wrote:

I vaguely recall this function not being particularly reliable for lambdas.  Also, are we sure this is always a VarDecl?  I thought there are cases where this is the return of a function (that is, a function returning a lambda, now being called) where this would be the function instead.  So at minimum this would need a test for that (and this might have to be a dyn_cast).

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


More information about the cfe-commits mailing list