[clang-tools-extra] [clangd] Retrieve documentation for member function instance from index (PR #153337)
Nathan Ridge via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 26 21:01:33 PDT 2025
================
@@ -1887,7 +1887,19 @@ class CodeCompleteFlow {
for (auto &Cand : C.first) {
if (Cand.SemaResult &&
Cand.SemaResult->Kind == CodeCompletionResult::RK_Declaration) {
- auto ID = clangd::getSymbolID(Cand.SemaResult->getDeclaration());
+ const NamedDecl *DeclToLookup = Cand.SemaResult->getDeclaration();
+ // For instantiations of members of class templates, the
+ // documentation will be stored at the member's original
+ // declaration.
+ // FIXME: We'd like to handle fields too but FieldDecl is missing a
+ // method equivalent to getInstantiatedFromMemberFunction().
+ if (const auto *FD = dyn_cast<FunctionDecl>(DeclToLookup)) {
+ if (const auto *InstantiatedFrom =
+ FD->getInstantiatedFromMemberFunction()) {
----------------
HighCommander4 wrote:
Makes sense, thanks! Done.
https://github.com/llvm/llvm-project/pull/153337
More information about the cfe-commits
mailing list