summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Store index::SymbolKind in HoverInfoKadir Cetinkaya2019-12-063-38/+37
| | | | | | | | | | | | | | | | | | Summary: LSP's SymbolKind has some shortcomings when it comes to C++ types, index::SymbolKind has more detailed info like Destructor, Parameter, MACRO etc. We are planning to make use of that information in our new Hover response, and it would be nice to display the Symbol type in full detail, rather than some approximation. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70723
* [clangd] Try to fix CompileCommandsTests on windows. NFCSam McCall2019-12-062-14/+21
|
* [clangd] Fix gcc warning about extra ";" [NFC]Mikael Holmen2019-12-061-1/+1
| | | | | | | | gcc complained with /data/repo/master/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp:326:30: warning: extra ';' [-Wpedantic] REGISTER_TWEAK(DefineOutline); ^
* [clangd] (take 2) Try harder to find a plausible `clang` as argv0, ↵Sam McCall2019-12-0611-107/+390
| | | | | | | | | | | | | | | | | | | | | | | | particularly on Mac. Summary: This was originally committed in 88bccded8fa169481fa367debf5ec615640635a1, and reverted in 93f77617abba512d2861e2fc50ce385883f587b6. This version is now much more testable: the "detect toolchain properties" part is still not tested but also not active in tests. All the command manipulation based on the detected properties is directly tested, and also not active in other tests. Fixes https://github.com/clangd/clangd/issues/211 Fixes https://github.com/clangd/clangd/issues/178 Reviewers: kbobyrev, ilya-biryukov Subscribers: mgorny, ormris, cfe-commits, usaxena95, kadircet, arphaman, jkorous, MaskRay Tags: #clang Differential Revision: https://reviews.llvm.org/D71029
* Revert "[AST] Traverse the class type loc inside the member type loc."Sterling Augustine2019-12-051-2/+2
| | | | | | | This reverts commit 7f93cb62280a73e3e899d49c45be8bfbac634b7d. The assertion at RecursiveASTVisitor.h:1169 fails when passed a TypeLocNode. Not sure if the correct fix is to use getTypeLocClass or something else.
* [clangd] Highlighting dependent types in more contextsNathan Ridge2019-12-052-1/+37
| | | | | | | | | | | | | | Fixes https://github.com/clangd/clangd/issues/214. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70746
* [clangd] Find reference to template parameter in 'sizeof...' expressionNathan Ridge2019-12-053-146/+180
| | | | | | | | | | | | | | Fixes https://github.com/clangd/clangd/issues/213. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70740
* [clangd] Simplify the code, NFC.Haojian Wu2019-12-054-5/+5
| | | | AST.getASTContext().getSourceManager() => AST.getSourceManager().
* [AST] Traverse the class type loc inside the member type loc.Haojian Wu2019-12-051-2/+2
| | | | | | | | | | | | | | | Summary: We are missing this currently. This would fix https://github.com/clangd/clangd/issues/216. Reviewers: ilya-biryukov Subscribers: mgorny, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70849
* [clangd] More unittests for cross-file rename.Haojian Wu2019-12-052-2/+153
| | | | | | | | | | | | | | | | | Summary: The previous unittests for cross-file rename was kind of weak. With this patch, we should have more test coverage, and it is easy to add more tests in the future. Reviewers: ilya-biryukov, kbobyrev Reviewed By: ilya-biryukov Subscribers: merge_guards_bot, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71050
* [clangd] Fix an incorrect comment, NFC.Haojian Wu2019-12-051-1/+1
|
* [clangd] Add xref for macro to static index.Utkarsh Saxena2019-12-053-49/+148
| | | | | | | | | | | | | | Summary: This adds the references for macros to the SymbolCollector (used for static index). Enabled if `CollectMacro` option is set. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70489
* [clangd] Add a tweak refactoring to wrap Objective-C string literals in ↵Alex Lorenz2019-12-043-0/+105
| | | | | | | | `NSLocalizedString` macros The commit adds a refactoring to Clangd that mimics the existing refactoring action in Xcode that wraps around an Objective-C string literal in an NSLocalizedString macro. Differential Revision: https://reviews.llvm.org/D69543
* [clangd] NFC, add getLangOpts helper to ParsedASTAlex Lorenz2019-12-0413-39/+35
| | | | | The addition of the helper is split out from https://reviews.llvm.org/D69543 as suggested by Kadir. I also updated the existing uses to use the new API.
* [clangd] register cuda language activation event and activate for .cuh filesptaylor2019-12-042-12/+14
| | | | | | | | | | | | | | Patch by Paul Taylor! Reviewers: hokein Reviewed By: hokein Subscribers: jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70041
* [clangd] Remove the hanging lit exit-signal.test.Haojian Wu2019-12-041-32/+0
| | | | | | | | The test was introduced in https://github.com/llvm/llvm-project/commit/19ac0eaf07e60173baa7ee77fa11568c30b87455. The test keeps hanging after running "check-clangd", remove it now and will add it back later after investigations.
* [clangd] Add no delayed templates to outline testsKadir Cetinkaya2019-12-041-0/+3
|
* [clangd] Define out-of-line qualify function nameKadir Cetinkaya2019-12-042-9/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: When moving function definitions to a different context, the function name might need a different spelling, for example in the header it might be: ``` namespace a { void foo() {} } ``` And we might want to move it into a context which doesn't have `namespace a` as a parent, then we must re-spell the function name, i.e: ``` void a::foo() {} ``` This patch implements a version of this which ignores using namespace declarations in the source file. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70656
* [clangd] Define out-of-line qualify return valueKadir Cetinkaya2019-12-042-24/+189
| | | | | | | | | | | | | | | | Summary: Return type might need qualification if insertion context doesn't have the same decls visible as the source context. This patch adds qualification for return value to cover such cases. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70535
* [clangd] Define out-of-line initial apply logicKadir Cetinkaya2019-12-043-4/+217
| | | | | | | | | | | | | | | | | | Summary: Initial implementation for apply logic, replaces function body with a semicolon in source location and copies the full function definition into target location. Will handle qualification of return type and function name in following patches to keep the changes small. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69298
* [clangd] Define out-of-line availability checksKadir Cetinkaya2019-12-045-2/+179
| | | | | | | | | | | | | | | | | | Summary: Initial availability checks for performing define out-of-line code action, which is a refactoring that will help users move function/method definitions from headers to implementation files. Proposed implementation only checks whether we have an interesting selection, namely function name or full function definition/body. Reviewers: hokein Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69266
* [clangd] Fix comparator const after c9c714c7054d555398c767cb39d7d97600b3d9d1Sam McCall2019-12-031-1/+1
|
* Reland [clangd] Rethink how SelectionTree deals with macros and #includes.Sam McCall2019-12-034-153/+361
| | | | | | This reverts commit 905b002c139f039a32ab9bf1fad63d745d12423f. Avoid tricky (and invalid) comparator for std::set.
* [NFC] Slightly improve wording in the commentsKirill Bobyrev2019-12-031-18/+18
| | | | | | Reviewed by: hokein Differential Revision: https://reviews.llvm.org/D70943
* Remove extraneous semicolon.Bill Wendling2019-12-021-1/+1
|
* Revert "[clangd] repair mac tests for 88bccded8fa1"Sam McCall2019-12-023-165/+22
| | | | Revert "[clangd] Try harder to find a plausible `clang` as argv0, particularly on Mac."
* [clangd] repair mac tests for 88bccded8fa1Sam McCall2019-12-022-8/+26
|
* [clangd] Try harder to find a plausible `clang` as argv0, particularly on Mac.Sam McCall2019-12-023-17/+142
| | | | | | | | | | | | | | | | | | | Summary: Fixes https://github.com/clangd/clangd/issues/211 Fixes https://github.com/clangd/clangd/issues/178 No tests - this is hard to test, and basically impossible to verify what we want (this produces compile commands that work on a real mac with recent toolchain) (Need someone on mac to verify it actually fixes these!) Reviewers: kbobyrev, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70863
* [clangd] Fix a regression issue in local rename.Haojian Wu2019-12-022-7/+20
| | | | | | | | | | | | | | Summary: The regression is that we can't rename symbols in annonymous namespaces. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70853
* Revert "[clangd] Rethink how SelectionTree deals with macros and #includes."Sam McCall2019-11-294-355/+153
| | | | | | | | This reverts commit 19daa21f841ad45290c923689ee3d25198651a4c. It causes a bunch of failures on a bot that I've been unable to reproduce so far: http://45.33.8.238/mac/3308/step_7.txt
* [clangd] Rethink how SelectionTree deals with macros and #includes.Sam McCall2019-11-294-153/+355
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The exclusive-claim model is successful at resolving conflicts over tokens between parent/child or siblings. However claims at the spelled-token level do the wrong thing for macro expansions, where siblings can be equally associated with the macro invocation. Moreover, any model that only uses the endpoints in a range can fail when a macro invocation occurs inside the node. To address this, we use the existing TokenBuffer in more depth. Claims are expressed in terms of expanded tokens, so there is no need to worry about macros, includes etc. Once we know which expanded tokens were claimed, they are mapped onto spelled tokens for hit-testing. This mapping is fairly flexible, currently the handling of macros is pretty simple (map macro args onto spellings, other macro expansions onto the macro name token). This mapping is in principle token-by-token for correctness (though there's some batching for performance). The aggregation of the selection enum is now more principled as we need to be able to aggregate several hit-test results together. For simplicity i removed the ability to determine selectedness of TUDecl. (That was originally implemented in 90a5bf92ff97b1, but doesn't seem to be very important or worth the complexity any longer). The expandedTokens(SourceLocation) helper could be added locally, but seems to make sense on TokenBuffer. Fixes https://github.com/clangd/clangd/issues/202 Fixes https://github.com/clangd/clangd/issues/126 Reviewers: hokein Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits, ilya-biryukov Tags: #clang Differential Revision: https://reviews.llvm.org/D70512
* [clangd] Fix 407ac2e, which was broken and committed too soonSam McCall2019-11-291-3/+3
|
* [clangd] Log cc1 args at verbose level.Sam McCall2019-11-293-4/+9
| | | | | | | | | | | | Summary: This will help debugging driver issues. Reviewers: kbobyrev Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70832
* [clangd] Correct the file path in Edit::replacements when generating the ↵Haojian Wu2019-11-293-8/+13
| | | | | | | | | | | | | | | | | rename edit. Summary: The file path was set to the file content previously, and it isn't covered by normal clangd & unittest code path (as we only uses the offset, length, replacement text). Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70828
* [clangd] Don't perform rename when the refs result from index is incomplete.Haojian Wu2019-11-282-13/+51
| | | | | | | | | | | | | | Summary: Also do an early return if the number of affected files > limit to save some unnecessary FileURI computations. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70811
* [clangd] Prefer the left character if the character on the right of the ↵Haojian Wu2019-11-283-7/+5
| | | | | | | | | | | | | | cursor is semicolon. Summary: This would make go-to-def works on the cases like int A = abc^; Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70807
* [clangd] Tweak the no-index error message for rename, NFC.Haojian Wu2019-11-281-1/+1
| | | | | | | | | | | | Summary: The current error message doesn't fit well for cross-file rename. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70809
* [clangd] Handle the missing call expr in targetDecl.Haojian Wu2019-11-272-0/+20
| | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: merge_guards_bot, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70773
* [clangd] Shutdown cleanly on signals.Sam McCall2019-11-277-12/+190
| | | | | | | | | | | | | | | | Summary: This avoids leaking PCH files if editors don't use the LSP shutdown protocol. This is one fix for https://github.com/clangd/clangd/issues/209 (Though I think we should *also* be unlinking the files) Reviewers: kadircet, jfb Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, jfb, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70684
* [clangd] Speed up when building rename edit.Haojian Wu2019-11-263-34/+90
| | | | | | | | | | | | | | Summary: We used to scan the code everytime when computing the LSP position to the offset (respect the LSP encoding). Now we only scan the source code once. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70441
* [NFC] ASSERT_EQ before accessing items in containersKirill Bobyrev2019-11-262-2/+8
| | | | | | | | | | | | As discussed offline, something different from `EXPECT_EQ` should be used to check if the container contains enough items before accessing them so that other tests can still be run even if the assertion fails as opposed to having `EXPECT_EQ` failing and then aborting the run due to the errors caused by out-of-bounds memory access. Reviewed by: ilya-biryukov Differential Revision: https://reviews.llvm.org/D70528
* [clangd] Implement cross-file rename.Haojian Wu2019-11-2613-145/+523
| | | | | | | | | | | | | | | | | Summary: This is the initial version. The cross-file rename is purely based on the index. It is hidden under a command-line flag, and only available for a small set of symbols. Reviewers: ilya-biryukov, sammccall Subscribers: merge_guards_bot, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69263
* Revert "Use InitLLVM to setup a pretty stack printer"Nico Weber2019-11-253-6/+3
| | | | | | | This reverts commit 3f76260dc0674cc0acb25f550a0f0c594cf537ea. Breaks at least these tests on Windows: Clang :: Driver/clang-offload-bundler.c Clang :: Driver/clang-offload-wrapper.c
* Use InitLLVM to setup a pretty stack printerRui Ueyama2019-11-263-3/+6
| | | | | | | | | | | | | | InitLLVM does not only save a few lines from main() but also makes the commands do the right thing for multibyte character pathnames on Windows (i.e. canonicalize argv's to UTF-8) because of the code we have in this file: https://github.com/llvm/llvm-project/blob/master/llvm/lib/Support/InitLLVM.cpp#L32 For many LLVM commands, we already have calls of InitLLVM, but there are still remainings. Differential Revision: https://reviews.llvm.org/D70702
* Fix an unused variable warning where a variable was only used in an assert.Eric Christopher2019-11-251-1/+3
|
* [clangd] Fix diagnostic location for macro expansionsKadir Cetinkaya2019-11-252-5/+42
| | | | | | | | | | | | | | | | | Summary: Diagnostic locations were broken when it was result of a macro expansion. This patch fixes it by using expansion location instead of location inside macro body. Fixes https://github.com/clangd/clangd/issues/201. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70494
* [clangd] Improve symbol qualification in DefineInline code actionKadir Cetinkaya2019-11-253-7/+154
| | | | | | | | | | | | | | | | | | | | | | Summary: Currently define inline action fully qualifies any names in the function body, which is not optimal and definitely natural. This patch tries to improve the situation by dropping any name specifiers shared by function and names spelled in the body. For example if you are moving definition of a function in namespace clang::clangd, and body has any decl's coming from clang or clang::clangd namespace, those qualifications won't be added since they are redundant. It also drops any qualifiers that are visible in target context. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69033
* [clangd] Helper for getting nested namespace qualificationKadir Cetinkaya2019-11-253-9/+263
| | | | | | | | | | | | | | | | | 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] Show lambda signature for lambda autocompletionsKirill Bobyrev2019-11-221-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | The original bug report can be found [here](https://github.com/clangd/clangd/issues/85) Given the following code: ```c++ void function() { auto Lambda = [](int a, double &b) {return 1.f;}; La^ } ``` Triggering the completion at `^` would show `(lambda)` before this patch and would show signature `(int a, double &b) const`, build a snippet etc with this patch. Reviewers: sammccall Reviewed by: sammccall Differential revision: https://reviews.llvm.org/D70445
* [clangd] Inactive regions support as an extension to semantic highlightingNathan Ridge2019-11-217-14/+104
| | | | Differential Revision: https://reviews.llvm.org/D67536
OpenPOWER on IntegriCloud