diff --git a/clang-tools-extra/clangd/Hover.cpp b/clang-tools-extra/clangd/Hover.cpp --- a/clang-tools-extra/clangd/Hover.cpp +++ b/clang-tools-extra/clangd/Hover.cpp @@ -996,13 +996,15 @@ HoverInfo::PassType PassType; + auto Parameters = resolveForwardingParameters(FD); + // Find argument index for N. - for (unsigned I = 0; I < CE->getNumArgs() && I < FD->getNumParams(); ++I) { + for (unsigned I = 0; I < CE->getNumArgs() && I < Parameters.size(); ++I) { if (CE->getArg(I) != OuterNode.ASTNode.get()) continue; // Extract matching argument from function declaration. - if (const ParmVarDecl *PVD = FD->getParamDecl(I)) { + if (const ParmVarDecl *PVD = Parameters[I]) { HI.CalleeArgInfo.emplace(toHoverInfoParam(PVD, PP)); if (N == &OuterNode) PassType.PassBy = getPassMode(PVD->getType()); diff --git a/clang-tools-extra/clangd/unittests/HoverTests.cpp b/clang-tools-extra/clangd/unittests/HoverTests.cpp --- a/clang-tools-extra/clangd/unittests/HoverTests.cpp +++ b/clang-tools-extra/clangd/unittests/HoverTests.cpp @@ -906,6 +906,35 @@ HI.CalleeArgInfo->Type = "int &"; HI.CallPassType = HoverInfo::PassType{PassMode::Ref, false}; }}, + {// make_unique-like function call + R"cpp( + struct Foo { + explicit Foo(int arg_a) {} + }; + template + T make(Args&&... args) + { + return T(args...); + } + + void code() { + int a = 1; + auto foo = make([[^a]]); + } + )cpp", + [](HoverInfo &HI) { + HI.Name = "a"; + HI.Kind = index::SymbolKind::Variable; + HI.NamespaceScope = ""; + HI.Definition = "int a = 1"; + HI.LocalScope = "code::"; + HI.Value = "1"; + HI.Type = "int"; + HI.CalleeArgInfo.emplace(); + HI.CalleeArgInfo->Name = "arg_a"; + HI.CalleeArgInfo->Type = "int"; + HI.CallPassType = HoverInfo::PassType{PassMode::Value, false}; + }}, { R"cpp( void foobar(const float &arg);