[clang] [clang-tools-extra] [clangd] CodeCompletion surface param names if possible (PR #206716)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 30 06:05:42 PDT 2026


================
@@ -3320,6 +3320,11 @@ static void AddFunctionParameterChunks(
 
   for (unsigned P = Start, N = Function->getNumParams(); P != N; ++P) {
     const ParmVarDecl *Param = Function->getParamDecl(P);
+    // Select the first parameter name for consistent results with Index.
+    for (auto *Redecl : Function->redecls()) {
+      if (auto *RParam = Redecl->getParamDecl(P); RParam->getIdentifier())
+        Param = RParam;
----------------
timon-ul wrote:

I just noticed that I missed the `break` by accident, but it passes, so `redecl()` is going through them from last to first, which is kinda annoying since I would prefer the other way around. Will think of a nicer way of doing this.

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


More information about the cfe-commits mailing list