[clangd] Simplify "preferred" vs "definition" logic a bit in XRefs AST code.
authorSam McCall <sam.mccall@gmail.com>
Fri, 24 Jan 2020 17:31:37 +0000 (18:31 +0100)
committerSam McCall <sam.mccall@gmail.com>
Thu, 26 Mar 2020 08:52:48 +0000 (09:52 +0100)
commit6324912592a1ff8d672e55e02ca63f769decb154
tree091848e5dce3b9d29a9e360cd7ffb8b0ee8fab56
parent1a27d63a8891076ad9176f1a70f372003bc55c2f
[clangd] Simplify "preferred" vs "definition" logic a bit in XRefs AST code.

Summary:
Now Preferred is always the canonical (first) decl, Definition is always the def
if available.

In practice the index was already forcing this behaviour anyway, so there's no
change. (Unless you weren't using this index, in which case this patch makes
textDocument/declaration and toggling work as expected).

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73369
clang-tools-extra/clangd/XRefs.cpp
clang-tools-extra/clangd/unittests/XRefsTests.cpp