summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/unittests/ASTTests.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [clangd] Replace shortenNamespace with getQualificationKadir Cetinkaya2020-01-031-25/+59
| | | | | | | | | | Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71652
* [clangd] Helper for getting nested namespace qualificationKadir Cetinkaya2019-11-251-0/+110
| | | | | | | | | | | | | | | | | Summary: Introduce a new helper for getting minimally required qualifiers necessary to spell a name at a point in a given DeclContext. Currently takes using directives and nested namespecifier of DeclContext itself into account. Initially will be used in define inline and outline actions. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69608
* [clangd] Untangle Hover from XRefs, move into own file.Sam McCall2019-11-191-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This is mostly mechanical, with a few exceptions: - getDeducedType moved into AST.h where it belongs. It now takes ASTContext instead of ParsedAST, and avoids using the preprocessor. - hover now uses SelectionTree directly rather than via getDeclAtPosition helper - hover on 'auto' used to find the decl that contained the 'auto' and use that to set Kind and documentation for the hover result. Now we use targetDecl() to find the decl matching the deduced type instead. This changes tests, e.g. 'variable' -> class for auto on lambdas. I think this is better, but the motivation was to avoid depending on the internals of DeducedTypeVisitor. This functionality is removed from the visitor. Reviewers: kadircet Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70357
* [clangd] Add targetDecl(), which determines what declaration an AST node ↵Sam McCall2019-09-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [clangd] Implementation of auto type expansion.Sam McCall2019-07-111-0/+42
Add a tweak for clangd to replace an auto keyword to the deduced type. This way a user can declare something with auto and then have the IDE/clangd replace auto with whatever type clangd thinks it is. In case of long/complext types this makes is reduces writing effort for the user. The functionality is similar to the hover over the auto keyword. Example (from the header): ``` /// Before: /// auto x = Something(); /// ^^^^ /// After: /// MyClass x = Something(); /// ^^^^^^^ ``` Patch by kuhnel! (Christian Kühnel) Differential Revision: https://reviews.llvm.org/D62855 llvm-svn: 365792
OpenPOWER on IntegriCloud