This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Enable indexing of template type parameters
ClosedPublic

Authored by kadircet on Feb 15 2019, 10:49 AM.

Diff Detail

Event Timeline

kadircet created this revision.Feb 15 2019, 10:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2019, 10:49 AM

It feels that storing template parameters in the index is a waste, one can only access them through the scope they are introduced in (there are out-of-line definitions of a function, but I think we treat every redeclaration of template headers separately).
Can we get the information from the AST whenever we need it?

kadircet updated this revision to Diff 187322.Feb 19 2019, 12:54 AM
  • Turn off indexing of template type parms for dynamic index

Yeah you are right, no need to have those in the index. I thought we looked at only index for findreferences(which turned out to be wrong, we also traverse ast), therefore I had turned this functionality on for dynamic index.

ilya-biryukov added inline comments.Feb 19 2019, 1:00 AM
clangd/XRefs.cpp
42–43

Should probably also handle TemplateTemplateParmDecl?
Could we add tests for template template parameters too?

// two most-used constructs with template template parameter references.
template<template <class> class U>
struct Foo {
  ^U<int> f;
  Foo<^U> x;
};
kadircet updated this revision to Diff 187342.Feb 19 2019, 3:34 AM
  • Add handling for template template type parameters
This revision is now accepted and ready to land.Feb 19 2019, 4:37 AM
kadircet updated this revision to Diff 187371.Feb 19 2019, 7:51 AM
kadircet marked an inline comment as done.
  • Option's name has changed
This revision was automatically updated to reflect the committed changes.