================
@@ -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.
----------------
HighCommander4 wrote:

In any case, here's a reason not to have SemaCodeComplete give us the "spelled" 
declaration:

```c++
template <typename T>
struct vector {
  void push(T);
};

int main() {
  vector<int> v;
  v.^  // signature shown is `push(int)`
}
```

Returning the instantiated declaration allows us to e.g. show the instantiated 
signature (`push(int)` rather than `push(T)`) which is more helpful to the user.

In that sense, the instantiated declaration provides strictly more information 
than the spelled declaration; the consumer can always query the spelled 
declaration (as we're doing here) if desired.

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

Reply via email to