[PATCH] D62579: [Index] Compute correct symbol kind for variable templates

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 29 11:29:54 PDT 2019

ilya-biryukov added inline comments.

Comment at: clang/lib/Index/IndexSymbol.cpp:99
+  if (auto *VT = dyn_cast<VarTemplateDecl>(D)) {
+    Info.Properties |= (SymbolPropertySet)SymbolProperty::Generic;
kadircet wrote:
> ilya-biryukov wrote:
> > kadircet wrote:
> > > what about function and class templates? Are they handled in somewhere else?
> > 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.
> ok then it makes sense, could you also add a test case for one of the fall-through cases(static member/parameter(?) etc.)?
Done. (Only static member, though, since we can't have templated parameters or non-static fields)

  rC Clang



More information about the cfe-commits mailing list