[PATCH] D71596: [clangd] Improve documentation for auto and implicit specs

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 17 07:49:09 PST 2019


ilya-biryukov added inline comments.


================
Comment at: clang-tools-extra/clangd/Hover.cpp:188
+// returns D.
+const NamedDecl *getExplicitSpec(const NamedDecl *D) {
+  if (auto *CTSD = llvm::dyn_cast<ClassTemplateSpecializationDecl>(D)) {
----------------
What's the purpose of this function?
I don't think its description has semantic meaning in C++, "implicit instantiations" do not have an "explicit specialization"...

It seems to be doing something to change a decl into something that could be used to query the index. If that's the case, we could probably have a name that's closer to the described goal.


================
Comment at: clang-tools-extra/clangd/Hover.cpp:200
+  // We only add documentation, so don't bother if we already have some, or
+  // Index isn't supplied.
+  if (!Hover.Documentation.empty() || !Index)
----------------
NIT: maybe remove `or Index isn't supplied`.
It's clear from the code, no need to duplicate it.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71596/new/

https://reviews.llvm.org/D71596





More information about the cfe-commits mailing list