[clangd] Implement semantic highlightings via findExplicitReferences
authorIlya Biryukov <ibiryukov@google.com>
Tue, 5 Nov 2019 18:06:12 +0000 (19:06 +0100)
committerIlya Biryukov <ibiryukov@google.com>
Tue, 5 Nov 2019 18:15:24 +0000 (19:15 +0100)
commit87e0cb4f1ad299c87c3e26676a9b31b3caf58921
tree8a17b015943cde1634cb737ba9761dfa370cb7d9
parenta9970036d43b4fb8622d7179603722b539756457
[clangd] Implement semantic highlightings via findExplicitReferences

Summary:
To keep the logic of finding locations of interesting AST nodes in one
place.

The advantage is better coverage of various AST nodes, both now and in
the future: as new nodes get added to `findExplicitReferences`, semantic
highlighting will automatically pick them up.

The drawback of this change is that we have to traverse declarations
inside our file twice in order to highlight dependent names, 'auto'
and 'decltype'. Hopefully, this should not affect the actual latency
too much, most time should be spent in building the AST and not
traversing it.

Reviewers: hokein

Reviewed By: hokein

Subscribers: nridge, merge_guards_bot, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69673
clang-tools-extra/clangd/FindTarget.cpp
clang-tools-extra/clangd/FindTarget.h
clang-tools-extra/clangd/SemanticHighlighting.cpp
clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp