summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Enable extraction of system includes from custom toolchainsKadir Cetinkaya2019-06-267-1/+344
| | | | | | | | | | | | | | | | | | Summary: Some custom toolchains come with their own header files and compiler drivers. Those compiler drivers implicitly know about include search path for those headers. This patch aims to extract that information from drivers and add it to the command line when invoking clang frontend. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62804 llvm-svn: 364389
* [clangd] Link and initialize target infosKadir Cetinkaya2019-06-263-0/+37
| | | | llvm-svn: 364387
* [clangd] Fix NestedNameSpecifierLoc in SelectionTreeSam McCall2019-06-252-3/+9
| | | | | | | | | | | | Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63708 llvm-svn: 364284
* [clangd] Narrow rename to local symbols.Haojian Wu2019-06-254-9/+181
| | | | | | | | | | | | | | | | | | | Summary: Previously, we performed rename for all kinds of symbols (local, global). This patch narrows the scope by only renaming symbols not being used outside of the main file (with index asisitance). Renaming global symbols is not supported at the moment (return an error). Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63426 llvm-svn: 364283
* [clangd] Cleanup the duplicated getTokenRange.Haojian Wu2019-06-253-38/+48
| | | | | | | | | | | | | | | | Summary: Also lift it to SourceCode.h, so that it can be used in other places (semantic code highlighting). Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63714 llvm-svn: 364280
* [clangd] Improve SelectionTree string representationSam McCall2019-06-241-1/+12
| | | | llvm-svn: 364180
* [clangd] Add include-mapping for C symbols.Haojian Wu2019-06-2111-192/+1198
| | | | | | | | | | | | | | | | | | | Summary: This resolves the issue of introducing c++-style includes for C files. - refactor the gen_std.py, make it reusable for parsing C symbols. - add a language mode to the mapping method to use different mapping for C and C++ files. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63270 llvm-svn: 364044
* [clangd] Include the diagnostics's code when comparing diagnosticsNathan Ridge2019-06-192-4/+230
| | | | | | | | | | | | | | | | Summary: This fixes https://github.com/clangd/clangd/issues/60 Reviewers: kadircet Reviewed By: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63316 llvm-svn: 363889
* [clangd] Consume error returned by cleanupAndFormatIlya Biryukov2019-06-191-0/+2
| | | | | | | When called by ClangdServer::applyTweak. No idea how to actually trigger this in practice, so no tests. llvm-svn: 363844
* [clangd] Format changes produced by renameIlya Biryukov2019-06-191-0/+9
| | | | | | | | | | | | | | Reviewers: hokein, kadircet, sammccall Reviewed By: kadircet Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63562 llvm-svn: 363843
* [clangd] Collect tokens of main files when building the ASTIlya Biryukov2019-06-196-4/+57
| | | | | | | | | | | | | | | | | | | | Summary: The first use of this is a code tweak to expand macro calls. Will later be used to build syntax trees. The memory overhead is small as we only store tokens of the main file. Reviewers: sammccall Reviewed By: sammccall Subscribers: mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62956 llvm-svn: 363803
* [clangd] Correct the MessageType enum values.Haojian Wu2019-06-191-3/+3
| | | | llvm-svn: 363798
* Revert "[clangd] Return vector<TextEdit> from applyTweak. NFC"Sam McCall2019-06-193-19/+5
| | | | | | This reverts commit r363691. llvm-svn: 363766
* [clangd] Add ClangdServer accessor for buffer contentsSam McCall2019-06-195-2/+26
| | | | llvm-svn: 363765
* [TEST] Fix test on Windows by looking for substrings rather than a regexDouglas Yung2019-06-191-4/+7
| | | | | | since the escaping of special characters appears to break on Windows. llvm-svn: 363761
* [clangd] Return vector<TextEdit> from applyTweak. NFCIlya Biryukov2019-06-183-5/+19
| | | | | | | | | For the same reasons as r363150, which got overwritten by changes in r363680. Sending without review to unbreak our integrate. llvm-svn: 363691
* [clangd] Remove the extra ";", NFCHaojian Wu2019-06-181-2/+2
| | | | llvm-svn: 363681
* [clangd] Add hidden tweaks to dump AST/selection.Sam McCall2019-06-1814-53/+359
| | | | | | | | | | | | | | | | | | | | | | | Summary: This introduces a few new concepts: - tweaks have an Intent (they don't all advertise as refactorings) - tweaks may produce messages (for ShowMessage notification). Generalized Replacements -> Effect. - tweaks (and other features) may be hidden (clangd -hidden-features flag). We may choose to promote these one day. I'm not sure they're worth their own feature flags though. Verified it in vim-clangd (not yet open source), curious if the UI is ok in VSCode. Reviewers: ilya-biryukov Subscribers: mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62538 llvm-svn: 363680
* [clangd] Add a capability to enable completions with fixes.Sam McCall2019-06-183-0/+8
| | | | | | | | | | | | Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63091 llvm-svn: 363664
* [clangd] Parse files without extensions if we don't have a compile command.Haojian Wu2019-06-182-2/+8
| | | | | | | | | | | | | | Summary: This would enable clangd for C++ standard library files. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63481 llvm-svn: 363663
* [clangd] Detect C++ language based on well-known file path in vscode extensionHaojian Wu2019-06-181-0/+4
| | | | | | | | | | | | | | | | | | | | Summary: Matching the "C++" pattern on the first line of the file doesn't cover all cases, MSVC C++ headers doesn't have such pattern. This patch introduce a new heuristic to detect language based on the file path. MSVC C++ standard headers are in the directory like "c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\include" Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63483 llvm-svn: 363662
* [clangd] Perform merge for main file symbols.Haojian Wu2019-06-172-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, we randomly pick one main file symbol in dynamic index, we may loose the ideal symbol (with definition location) in the index. It fixes the issue where sometimes we fail to go to the symbol definition, see: 1. call go-to-decl on Foo in Foo.cpp 2. jump to Foo.h, call go-to-def on Foo in Foo.h we can't go back to Foo.cpp -- because we open Foo.cpp, Foo.h in clangd, both files have Foo symbol (one with def&decl, one with decl only), we randomely choose one. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63425 llvm-svn: 363568
* [clangd] Bump vscode-clangd v0.0.15.Haojian Wu2019-06-171-1/+1
| | | | | | | CHANGELOG: - support detecting C++ language from first line (`-*- C++ -*-`) of the file. llvm-svn: 363555
* [clangd] Detect C++ for extension-less source files in vscode extensionHaojian Wu2019-06-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | Summary: Extend our extension to support detecting these files as C++ files based on the first line (`-*- C++ -*-`), it will make clangd work on C++ standard headers (e.g. iostream). We use the contributes.languages[1] to enrich the builtin VScode C++ support. [1]: https://code.visualstudio.com/api/references/contribution-points#contributes.languages Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63397 llvm-svn: 363554
* [clangd] Type hierarchy subtypesNathan Ridge2019-06-167-38/+283
| | | | | | | | | | | | | | | | | Summary: This builds on the relations support added in D59407, D62459, D62471, and D62839 to implement type hierarchy subtypes. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, mgrang, arphaman, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58880 llvm-svn: 363506
* Fix gcc-05.4 bot failures caused by in r363481 "[clangd] Index API and ↵Don Hinton2019-06-161-1/+2
| | | | | | | | | | implementations for relations" Use std::make_tuple instead of initializer list to make gcc-5.4 happy. See https://reviews.llvm.org/D62839 for details. llvm-svn: 363504
* [clangd] Index API and implementations for relationsNathan Ridge2019-06-1524-143/+454
| | | | | | | | | | | | | | | | | Summary: This builds on the relations support added in D59407, D62459, and D62471 to expose relations in SymbolIndex and its implementations. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62839 llvm-svn: 363481
* [clangd] Bump vscode-clangd v0.0.14Haojian Wu2019-06-141-1/+1
| | | | | | | | | CHANGELOG: - use the vscode-buildin feature to detect language (rather than using file extensions), this fixes the extension not working on non-standard C++ files (e.g. via files.associations) llvm-svn: 363375
* [clangd] Don't maintain a list of c-family extensions in vscode extension.Haojian Wu2019-06-141-10/+11
| | | | | | | | | | | | | | | | Summary: There is no need to maintain this list by ourself, vscode already provides this feature. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63323 llvm-svn: 363372
* Test commitShaurya Gupta2019-06-141-1/+0
| | | | llvm-svn: 363365
* [Clangd] Fixed clangd diagnostics priorityKadir Cetinkaya2019-06-132-14/+19
| | | | | | | | | | | | | | | | | | | | Summary: - Fixed diagnostics where zero width inserted ranges were being used instead of the whole token - Added unit tests Patch by @SureYeaah ! Reviewers: sammccall, kadircet Reviewed By: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D63222 llvm-svn: 363253
* [clangd] Treat lambdas as functions when preparing hover responseKadir Cetinkaya2019-06-132-19/+108
| | | | | | | | | | | | Reviewers: sammccall, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62814 llvm-svn: 363237
* [clangd] Return TextEdits from ClangdServer::applyTweakIlya Biryukov2019-06-123-9/+12
| | | | | | | | | | | | | | | | | | | | Summary: Instead of `tooling::Replacements`. So that embedders do not need to store the contents of the file. This also aligns better with `ClangdServer::rename`. Reviewers: kadircet, hokein Reviewed By: hokein Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63140 llvm-svn: 363150
* [clangd] Fix typo in GUARDED_BY()Nikolai Kosjar2019-06-121-1/+1
| | | | | | | | | | | | Reviewers: ilya-biryukov, kadircet, sammccall Subscribers: javed.absar, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63193 llvm-svn: 363139
* [clangd] Add missing header guard.Haojian Wu2019-06-111-0/+5
| | | | llvm-svn: 363037
* [clangd] Fix gcc warning by removing extra ";"Mikael Holmen2019-06-111-1/+1
| | | | llvm-svn: 363034
* [clangd] Remove old hidden -use-dex-index flagSam McCall2019-06-102-8/+1
| | | | llvm-svn: 362978
* [clangd] Revamp textDocument/onTypeFormatting.Sam McCall2019-06-1010-43/+774
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The existing implementation (which triggers on }) is fairly simple and has flaws: - doesn't trigger frequently/regularly enough (particularly in editors that type the } for you) - often reformats too much code around the edit - has jarring cases that I don't have clear ideas for fixing This implementation is designed to trigger on newline, which feels to me more intuitive than } or ;. It does have allow for reformatting after other characters - it has a basic behavior and a model for adding specialized behavior for particular characters. But at least initially I'd stick to advertising \n in the capabilities. This also handles comment splitting: when you insert a line break inside a line comment, it will make the new line into an aligned line comment. Working on tests, but want people to patch it in and try it - it's hard to see if "feel" is right purely by looking at a test. Reviewers: ilya-biryukov, hokein Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60605 llvm-svn: 362939
* [clangd] Stop marshalling/requiring FormattingOptions. We never did anything ↵Sam McCall2019-06-103-41/+15
| | | | | | with them. llvm-svn: 362934
* [clangd] Return empty results on spurious completion triggersIlya Biryukov2019-06-072-22/+18
| | | | | | | | | | | | | | | | | | | | | Summary: We currently return an error, this causes `coc.nvim` and VSCode to show an error message in the logs. Returning empty list of completions allows to avod the error message without altering other user-visible behavior. Reviewers: sammccall Reviewed By: sammccall Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62999 llvm-svn: 362811
* [clangd] Remove unused signature help quality signal. NFCIlya Biryukov2019-06-063-9/+3
| | | | | | | | ContainsActiveParameter is not used anywhere, set incorrectly (see the removed FIXME) and has no unit tests. Removing it to simplify the code. llvm-svn: 362686
* [clangd] Minor cleanup. NFCIlya Biryukov2019-06-041-1/+0
| | | | | | Removed unused using declaration from TweakTests.cpp llvm-svn: 362517
* [clangd] Also apply adjustArguments when returning fallback commandsKadir Cetinkaya2019-06-042-2/+6
| | | | | | | | | | | | Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62856 llvm-svn: 362496
* Fix -Wparentheses warning. NFCI.Simon Pilgrim2019-06-041-2/+2
| | | | llvm-svn: 362491
* Fix Wshadow warningSimon Pilgrim2019-06-041-2/+2
| | | | llvm-svn: 362489
* [clangd] Support offsets for parameters in signatureHelpIlya Biryukov2019-06-047-123/+213
| | | | | | | | | | | | | | | | Summary: Added to LSP in version 3.14 Reviewers: hokein Reviewed By: hokein Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62476 llvm-svn: 362481
* [clangd] Fix a crash when clang-tidy is disabledIlya Biryukov2019-06-042-7/+46
| | | | llvm-svn: 362469
* [clangd] SymbolCollector support for relationsNathan Ridge2019-06-043-12/+75
| | | | | | | | | | | | | | | | | | | Summary: The only relation currently collected is RelationBaseOf, because this is all we need for type hierarchy subtypes. Additional relations can be collected in the future as the need arises. This patch builds on D59407 and D62459. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62471 llvm-svn: 362467
* [CodeComplete] Add a bit more whitespace to completed patternsIlya Biryukov2019-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: E.g. we now turn `while(<#cond#>){` into `while (<#cond#>) {` This slightly improves the final output. Should not affect clients that format the result on their own. Reviewers: gribozavr Reviewed By: gribozavr Subscribers: jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62616 llvm-svn: 362363
* [clangd] Serialization support for RelationSlabNathan Ridge2019-06-034-6/+180
| | | | | | | | | | | | | | Summary: This builds on D59407 to provide YAML and RIFF serialization support. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62459 llvm-svn: 362353
OpenPOWER on IntegriCloud