This is an archive of the discontinued LLVM Phabricator instance.

[clang][Index] Enable indexing of Template Type Parameters behind a flag
ClosedPublic

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

Details

Summary

clangd uses indexing api to provide references and it was not possible
to perform symbol information for template parameters. This patch enables
visiting of TemplateTypeParmTypeLocs.

This change also deletes TemplateTemplateParmType from funcitonLocal check.

Diff Detail

Repository
rC Clang

Event Timeline

kadircet created this revision.Feb 15 2019, 10:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2019, 10:48 AM
ilya-biryukov added inline comments.Feb 18 2019, 10:05 AM
lib/Index/IndexingContext.cpp
51

Do we call handleDecl for template parameters now too?

unittests/Index/IndexTests.cpp
182

could we add a template template parameter into the test too?

kadircet updated this revision to Diff 187341.Feb 19 2019, 3:28 AM
kadircet marked 2 inline comments as done.
  • Fix handling of TemplateTemplateTypeParams
kadircet edited the summary of this revision. (Show Details)Feb 19 2019, 3:29 AM
kadircet added inline comments.
lib/Index/IndexingContext.cpp
51

No we don't. I believe having the decl itself is not that useful for a template parameter without a reference to it. We only call handlereference.

ilya-biryukov added inline comments.Feb 19 2019, 7:15 AM
include/clang/Index/IndexingAction.h
49

NIT: maybe rename to IndexTemplateParameters? The ParmDecl is a somewhat weird name that does not add much clarity.

lib/Index/IndexingContext.cpp
51

I'm probably call both just for the sake of symmetry.
How does IndexParametersInDeclarations behaves? When set to true will it call both handleDecl and handleReference?
I'd argue we should do the same for template parameters.

kadircet updated this revision to Diff 187370.Feb 19 2019, 7:50 AM
kadircet marked 2 inline comments as done.
  • Change options name
  • Also index decls
lib/Index/IndexingContext.cpp
51

yes it calls both, OK than adding also the handleDecl

ilya-biryukov accepted this revision.Feb 19 2019, 9:29 AM

LGTM, but see the comment about avoiding code duplication

lib/Index/IndexDecl.cpp
680

Maybe do it once on top of TP to avoid code duplication?

This revision is now accepted and ready to land.Feb 19 2019, 9:29 AM
kadircet updated this revision to Diff 187528.Feb 20 2019, 12:59 AM
kadircet marked 2 inline comments as done.
  • Move handleDecl call to top of the loop
This revision was automatically updated to reflect the committed changes.