================ @@ -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()) { ---------------- zyn0217 wrote:
I think so? getInstantiatedFromMemberFunction gives you the last pattern that this instantiation comes from, and that pattern could be a half-instantiated template declaration. So if you're looking for the primary template, I think we should turn to getTemplateInstantiationPattern. Also note that there are some edge cases where we lack a tracking of the pattern, e.g. a templated friend declaration https://github.com/llvm/llvm-project/pull/153337 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits