This is an archive of the discontinued LLVM Phabricator instance.

[Index] Compute correct symbol kind for variable templates
ClosedPublic

Authored by ilya-biryukov on May 29 2019, 5:33 AM.

Event Timeline

ilya-biryukov created this revision.May 29 2019, 5:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 29 2019, 5:33 AM
kadircet added inline comments.May 29 2019, 7:10 AM
clang/lib/Index/IndexSymbol.cpp
99

what about function and class templates? Are they handled in somewhere else?

ilya-biryukov added inline comments.May 29 2019, 8:04 AM
clang/lib/Index/IndexSymbol.cpp
99

Yeah, they're handled in ifs and a large switch below. I tried unifying those cases (matching a TemplateDecl here instead of VarTemplateDecl), but they start producing different results for template classes and this function is mostly not called for templates from withing the index library (only for the underlying declarations) and it's only clangd that cares about the returned value in that case.

So I decided to make a minimal change that fixes clangd, but does not change behavior of the index library to avoid potential fallout of a more general fix.

kadircet accepted this revision.May 29 2019, 10:16 AM

LGTM

clang/lib/Index/IndexSymbol.cpp
99

ok then it makes sense, could you also add a test case for one of the fall-through cases(static member/parameter(?) etc.)?

This revision is now accepted and ready to land.May 29 2019, 10:16 AM
ilya-biryukov marked 4 inline comments as done.
  • Add a test for static variable template member
This revision was automatically updated to reflect the committed changes.
ilya-biryukov added inline comments.May 29 2019, 11:27 AM
clang/lib/Index/IndexSymbol.cpp
99

Done. (Only static member, though, since we can't have templated parameters or non-static fields)