summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/FindTarget.h
Commit message (Collapse)AuthorAgeFilesLines
* [clangd] targetDecl() returns only NamedDecls.Sam McCall2020-01-031-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: While it's perfectly reasonable for non-named decls such as static_assert to resolve to themselves: - nothing else ever resolves to them - features based on references (hover, highlight, find refs etc) tend to be uninteresting where only trivial references are possible - returning NamedDecl is a more convenient API (we cast to it in many places) - this aligns closer to findExplicitReferences/explicitReferenceTargets This fixes a crash in explicitReferenceTargets: if the target is a non-named decl then there's an invalid unchecked cast to NamedDecl. In practice this means when hovering over e.g. a static_assert: - before ac3f9e4842, we would show a (boring) hover card - after ac3f9e4842, we would crash - after this patch, we will show nothing Reviewers: kadircet, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D72163
* [clangd] Reorder FindTarget.h - group targetDecl() stuff and ↵Sam McCall2020-01-021-40/+43
| | | | findExplicitReferences(). NFC
* [clangd] Improve documentation for auto and implicit specsKadir Cetinkaya2019-12-191-0/+12
| | | | | | | | | | | | | | | | | | Summary: Clangd didn't fill documentation for `auto` when it wasn't available in index. Also it wasn't showing any documentations for implicit instantiations. This patch ensures auto and normal decl case behaves in the same way and also makes use of the explicit template specialization while fetching comments for implicit instantiations. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71596
* [clangd] Implement semantic highlightings via findExplicitReferencesIlya Biryukov2019-11-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [clangd] Report declaration references in findExplicitReferences.Haojian Wu2019-10-181-0/+2
| | | | | | | | | | | | Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68977 llvm-svn: 375226
* [clangd] Change constness of parameters to findExplicitRefsKadir Cetinkaya2019-09-251-2/+2
| | | | | | | | | | | | | | | | | | Summary: Recursive AST requires non-const ast nodes, but it doesn't really mutate them. In addition to that, in clangd we mostly have const ast nodes. So it makes sense to move the const_cast into callee rather than having it at every caller in the future. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68027 llvm-svn: 372888
* [clangd] Add missing header guard, NFC.Haojian Wu2019-09-251-0/+5
| | | | llvm-svn: 372860
* [clangd] A helper to find explicit references and their namesIlya Biryukov2019-09-251-0/+34
| | | | | | | | | | | | | | | | | | | | | | Summary: Allows to simplify pending code tweaks: - the upcoming DefineInline tweak (D66647) - remove using declaration (D56612) - qualify name under cursor (D56610) Another potential future application is simplifying semantic highlighting. Reviewers: kadircet Reviewed By: kadircet Subscribers: mgrang, jfb, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67826 llvm-svn: 372859
* [clangd] Add targetDecl(), which determines what declaration an AST node ↵Sam McCall2019-09-031-0/+144
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 llvm-svn: 370746
OpenPOWER on IntegriCloud