[PATCH] D71090: [clangd] Navigation from definition of template specialization to primary template
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 7 21:51:29 PST 2019
nridge marked an inline comment as done.
nridge added inline comments.
================
Comment at: clang-tools-extra/clangd/XRefs.cpp:240
+ // it's more useful to navigate to the template declaration.
+ if (Preferred->getLocation() == IdentStartLoc) {
+ if (auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(Preferred)) {
----------------
nridge wrote:
> sammccall wrote:
> > sammccall wrote:
> > > Be aware that this is going to break "go to definition" toggling between def and decl. I think that's fine.
> > (I think you probably want the macro-arg-expanded location here)
> For what will this break toggling? Aas far as I'm aware, partial and explicit specializations of templates do not have separate declarations.
I stand corrected: I checked, and it seems like specializations can indeed have forward declarations.
I expect they are relatively rare, though, and it's probably fine to break toggling for them, like you said.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71090/new/
https://reviews.llvm.org/D71090
More information about the cfe-commits
mailing list