[clangd] Add targetDecl(), which determines what declaration an AST node refers to.

Summary:
This is the first part of an effort to "unbundle" our libIndex use into separate
concerns (AST traversal, token<->node mapping, node<->decl mapping,
decl<->decl relationshipes).

Currently, clangd relies on libIndex to associate tokens, AST nodes, and decls.
This leads to rather convoluted implementations of e.g. hover and
extract-function, which are not naturally thought of as indexing applications.

The idea is that by decoupling different concerns, we make them easier
to use, test, and combine, and more efficient when only one part is needed.
There are some synergies between e.g. traversal and finding
relationships between decls, hopefully the benefits outweight these.

Reviewers: kadircet, ilya-biryukov

Subscribers: mgorny, MaskRay, jkorous, arphaman, jfb, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D66751

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@370746 91177308-0d34-0410-b5e6-96231b3b80d8
6 files changed