summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Dex iterator printer shows query structure, not iterator state.Sam McCall2018-10-025-30/+48
| | | | | | | | | | | | | | Summary: This makes it suitable for logging (which immediately found a bug, to be fixed in the next patch...) Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52715 llvm-svn: 343580
* [clangd] Cache FS stat() calls when building preamble.Eric Liu2018-10-028-33/+206
| | | | | | | | | | | | | | | | | | | | Summary: The file stats can be reused when preamble is reused (e.g. code completion). It's safe to assume that cached status is not outdated as we assume preamble files to remain unchanged. On real file system, this made code completion ~20% faster on a measured file (with big preamble). The preamble build time doesn't change much. Reviewers: sammccall, ilya-biryukov Reviewed By: sammccall Subscribers: mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52419 llvm-svn: 343576
* [clangd] Remove override result handling logic from clangdKadir Cetinkaya2018-10-021-90/+9
| | | | | | | | | | | | | | | | | Summary: Since we plan to move handling of override suggestions to Sema with D52225 this patch just makes sure clangd-side has no logic related to that anymore and updates tests. Reviewers: ioeric, ilya-biryukov Reviewed By: ioeric Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D52226 llvm-svn: 343567
* [clangd] Query dex index using query-style trigrams, not identifier-style ↵Sam McCall2018-10-011-1/+1
| | | | | | trigrams llvm-svn: 343453
* [clangd] Fix header mapping for std::string. NFCEric Liu2018-10-011-0/+1
| | | | | | Some implementation has std::string declared in <iosfwd>. llvm-svn: 343448
* [clangd] Initial supoprt for cross-namespace global code completion.Eric Liu2018-09-276-15/+68
| | | | | | | | | | | | | | | | | | | | | Summary: When no scope qualifier is specified, allow completing index symbols from any scope and insert proper automatically. This is still experimental and hidden behind a flag. Things missing: - Scope proximity based scoring. - FuzzyFind supports weighted scopes. Reviewers: sammccall Reviewed By: sammccall Subscribers: kbobyrev, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52364 llvm-svn: 343248
* [clangd] Add more tracing to index queries. NFCEric Liu2018-09-273-2/+28
| | | | | | | | | | Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52611 llvm-svn: 343247
* Introduce completionItemKind capability support.Kadir Cetinkaya2018-09-274-35/+131
| | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D52616 llvm-svn: 343237
* [clangd] Make IncludeInserter less slow. NFCEric Liu2018-09-272-9/+9
| | | | llvm-svn: 343223
* Tell whether file/folder for include completions.Kadir Cetinkaya2018-09-272-0/+12
| | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D52547 llvm-svn: 343221
* Improve diagnostics range reporting.Kadir Cetinkaya2018-09-271-0/+11
| | | | | | | | | | | | | | | | Summary: If we have some range information coming from clang diagnostic, promote that one even if it doesn't contain diagnostic location inside. Reviewers: sammccall, ioeric Reviewed By: ioeric Subscribers: ilya-biryukov, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D52544 llvm-svn: 343197
* [clangd] Fix bugs with incorrect memory estimate reportKirill Bobyrev2018-09-263-11/+12
| | | | | | | | | | | | | | * With the current implementation, `sizeof(std::vector<Chunk>)` is added twice to the `Dex` memory estimate which is incorrect * `Dex` logs memory usage estimation before `BackingDataSize` is set and hence the log report excludes size of the external `SymbolSlab` which is coupled with `Dex` instance Reviewed By: ioeric Differential Revision: https://reviews.llvm.org/D52503 llvm-svn: 343117
* [docs] Update PostingList string representation formatKirill Bobyrev2018-09-261-3/+2
| | | | | | | | | | | | Because `PostingList` objects are compressed, it is now impossible to see elements other than the current one and the documentation doesn't match implementation anymore. Reviewed By: ioeric Differential Revision: https://reviews.llvm.org/D52545 llvm-svn: 343116
* Removed extra semicolon to fix Wpedantic. (NFCI).Simon Pilgrim2018-09-261-1/+1
| | | | llvm-svn: 343083
* [clangd] Fix crash if pending computations were active on exitIlya Biryukov2018-09-262-62/+69
| | | | | | | | | | | | | | | | Summary: Make sure JSONRPCDispatcher outlives the worker threads, they access its fields to remove the stored cancellations when Context dies. Reviewers: sammccall, ioeric Reviewed By: ioeric Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52420 llvm-svn: 343067
* [clangd] Handle template args for disabled function arg snippetsIlya Biryukov2018-09-261-6/+36
| | | | | | | | | | | | Reviewers: kadircet, ioeric, sammccall Reviewed By: kadircet Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D52422 llvm-svn: 343066
* [clangd] Extract mapper logic from clangd-indexer into a library.Sam McCall2018-09-256-69/+126
| | | | | | | | | | | | | Summary: Soon we can drop support for MR-via-YAML. I need to modify some out-of-tree versions to use the library, first. Reviewers: kadircet Subscribers: mgorny, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D52465 llvm-svn: 343019
* [clangd] Fix reversed RIFF/YAML serializationSam McCall2018-09-251-2/+2
| | | | llvm-svn: 343017
* [clangd] Merge binary + YAML serialization behind a (mostly) common interface.Sam McCall2018-09-259-144/+146
| | | | | | | | | | | | | | | | | Summary: Interface is in one file, implementation in two as they have little in common. A couple of ad-hoc YAML functions left exposed: - symbol -> YAML I expect to keep for tools like dexp - YAML -> symbol is used for the MR-style indexer, I think we can eliminate this (merge-on-the-fly, else use a different serialization) Reviewers: kbobyrev Subscribers: mgorny, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52453 llvm-svn: 342999
* [clangd] NFC: Simplify code, enforce LLVM Coding StandardsKirill Bobyrev2018-09-256-73/+73
| | | | | | | | | | | | | | | | For consistency, functional-style code pieces are replaced with their simple counterparts to improve readability. Also, file headers are fixed to comply with LLVM Coding Standards. `static` member of anonymous namespace is not marked `static` anymore, because it is redundant. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D52466 llvm-svn: 342974
* [clangd] Fix some buildbots after r342965Kirill Bobyrev2018-09-251-1/+1
| | | | | | Some compilers fail to parse struct default member initializer. llvm-svn: 342970
* [clangd] Implement VByte PostingList compressionKirill Bobyrev2018-09-253-38/+210
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements Variable-length Byte compression of `PostingList`s to sacrifice some performance for lower memory consumption. `PostingList` compression and decompression was extensively tested using fuzzer for multiple hours and runnning significant number of realistic `FuzzyFindRequests`. AddressSanitizer and UndefinedBehaviorSanitizer were used to ensure the correct behaviour. Performance evaluation was conducted with recent LLVM symbol index (292k symbols) and the collection of user-recorded queries (7751 `FuzzyFindRequest` JSON dumps): | Metrics | Before| After | Change (%) | ----- | ----- | ----- | ----- | Memory consumption (posting lists only), MB | 54.4 | 23.5 | -60% | Time to process queries, sec | 7.70 | 9.4 | +25% Reviewers: sammccall, ioeric Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D52300 llvm-svn: 342965
* [clangd] Fix build bot after r342961Eric Liu2018-09-251-4/+3
| | | | | | | Use llvm::isAlpha instead of std::isalpha etc. This should fix bot failure: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/20180 llvm-svn: 342964
* [clangd] Check that scheme is valid when parsing URI.Eric Liu2018-09-251-2/+20
| | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52455 llvm-svn: 342961
* Fix a typo in the help of clangdSylvestre Ledru2018-09-251-1/+1
| | | | llvm-svn: 342960
* [clangd] Fix uninit bool in r342888Sam McCall2018-09-241-1/+1
| | | | llvm-svn: 342903
* [clangd] Do bounds checks while reading data, otherwise var-length records ↵Sam McCall2018-09-241-139/+138
| | | | | | are too painful. NFC llvm-svn: 342888
* [clangd] Force Dex to respect symbol collector flagsKirill Bobyrev2018-09-241-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | `Dex` should utilize `FuzzyFindRequest.RestrictForCodeCompletion` flags and omit symbols not meant for code completion when asked for it. The measurements below were conducted with setting `FuzzyFindRequest.RestrictForCodeCompletion` to `true` (so that it's more realistic). Sadly, the average latency goes down, I suspect that is mostly because of the empty queries where the number of posting lists is critical. | Metrics | Before | After | Relative difference | ----- | ----- | ----- | ----- | Cumulative query latency (7000 `FuzzyFindRequest`s over LLVM static index) | 6182735043 ns | 7202442053 ns | +16% | Whole Index size | 81.24 MB | 81.79 MB | +0.6% Out of 292252 symbols collected from LLVM codebase 136926 appear to be restricted for code completion. Reviewers: ioeric Differential Revision: https://reviews.llvm.org/D52357 llvm-svn: 342866
* [clangd] Remember to serialize symbol origin in YAML.Eric Liu2018-09-211-0/+15
| | | | llvm-svn: 342730
* [clangd] Add option to enable/disable function argument snippets.Kadir Cetinkaya2018-09-191-0/+8
| | | | | | | | | | | | | | | | Summary: Currently LSP clients cannot directly change EnableFunctionArgSnippets parameter. This patch is to provide them with a way to enable/disable that functionality. Reviewers: hokein, ioeric, ilya-biryukov Reviewed By: ilya-biryukov Subscribers: sammccall, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D51214 llvm-svn: 342533
* [clangd] Store preamble macros in dynamic index.Eric Liu2018-09-191-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Pros: o Loading macros from preamble for every completion is slow (see profile). o Calculating macro USR is also slow (see profile). o Sema can provide a lot of macro completion results (e.g. when filter is empty, 60k for some large TUs!). Cons: o Slight memory increase in dynamic index (~1%). o Some extra work during preamble build (should be fine as preamble build and indexAST is way slower). Before: {F7195645} After: {F7195646} Reviewers: ilya-biryukov, sammccall Reviewed By: sammccall Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52078 llvm-svn: 342529
* [clangd] Fix error handling for SymbolID parsing (notably YAML and dexp)Sam McCall2018-09-185-21/+22
| | | | llvm-svn: 342505
* [clangd] Get rid of Decls parameter in indexMainDecls. NFCEric Liu2018-09-183-13/+11
| | | | | | It's already available in ParsedAST. llvm-svn: 342473
* [clangd] Merge ClangdServer::DynamicIndex into FileIndex. NFC.Eric Liu2018-09-184-117/+120
| | | | | | | | | | | | | | | | | | | | Summary: FileIndex now provides explicit interfaces for preamble and main file updates. This avoids growing parameter list when preamble and main symbols diverge further (e.g. D52078). This also gets rid of the hack in `indexAST` that inferred main file index based on `TopLevelDecls`. Also separate `indexMainDecls` from `indexAST`. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52222 llvm-svn: 342460
* [clangd] dexp tool uses llvm::cl to parse its flags.Sam McCall2018-09-181-70/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We can use cl::ResetCommandLineParser() to support different types of command-lines, as long as we're careful about option lifetimes. (I tried using subcommands, but the error messages were bad) I found a mostly-reasonable pattern to isolate the fiddly parts. Added -scope and -limit flags to the `find` command to demonstrate. (Note that scope support seems to be broken in dex?) Fixed symbol lookup to parse symbol IDs. Caveats: - with command help (e.g. `find -help`), you also get some spam about required arguments. This is a bug in llvm::cl, which prints these to errs() rather than the designated stream. Reviewers: kbobyrev Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51989 llvm-svn: 342456
* [clangd] Update code completion for #include completions in r342449Sam McCall2018-09-181-4/+10
| | | | llvm-svn: 342453
* [clangd] Adapt API change after 342451.Eric Liu2018-09-183-7/+8
| | | | llvm-svn: 342452
* [clangd] Get rid of AST matchers in SymbolCollector. NFCEric Liu2018-09-171-13/+36
| | | | | | | | | | Reviewers: ilya-biryukov, kadircet Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D52089 llvm-svn: 342362
* [clangd] Don't override the preamble while completing inside it, it doesn't ↵Sam McCall2018-09-141-2/+11
| | | | | | | | | | | | | | | | | | | | work. Summary: To stay fast, enable single-file-mode instead. This is fine since completions in the preamble are simple. The net effect for now is to suppress the spurious TopLevel completions when completing inside the preamble. Once Sema has include directive completion, this will be more important. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52071 llvm-svn: 342230
* [clangd] Don't double-infer compile commands after r342228Sam McCall2018-09-141-2/+0
| | | | llvm-svn: 342229
* [clangd] NFC: Fix IndexBenchmark CLI arguments handlingKirill Bobyrev2018-09-141-3/+5
| | | | llvm-svn: 342227
* [clangd] Update IndexerMain.cpp file comment after rename. NFCIlya Biryukov2018-09-141-1/+1
| | | | llvm-svn: 342226
* [clangd] Fix TUScheduler typosFangrui Song2018-09-142-7/+7
| | | | llvm-svn: 342198
* [clangd] Introduce PostingList interfaceKirill Bobyrev2018-09-137-92/+150
| | | | | | | | | | | | | | | | This patch abstracts `PostingList` interface and reuses existing implementation. It will be used later to test different `PostingList` representations. No functionality change is introduced, this patch is mostly refactoring so that the following patches could focus on functionality while not being too hard to review. Reviewed By: sammccall, ioeric Differential Revision: https://reviews.llvm.org/D51982 llvm-svn: 342155
* [clangd] Fix Dexp buildKirill Bobyrev2018-09-131-1/+1
| | | | | | %s/MaxCandidateCount/Limit/g after rL342138. llvm-svn: 342143
* [clangd] Cleanup FuzzyFindRequest filtering limit semanticsKirill Bobyrev2018-09-136-19/+20
| | | | | | | | | | | As discussed during D51860 review, it is better to use `llvm::Optional` here as it has clear semantics which reflect intended behavior. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D52028 llvm-svn: 342138
* [clangd] Use JSON format in benchmark requests readerKirill Bobyrev2018-09-131-36/+31
| | | | | | | | | | | | After `FuzzyFindRequest` JSON (de)serialization was introduced, it should replace ad-hoc fuzzy-find request parsing implemented in the IndexBenchmark driver. Reviewed By: ilya-biryukov Differential Revision: https://reviews.llvm.org/D51971 llvm-svn: 342137
* [clangd] Allow all LSP methods to signal cancellation via $/cancelRequestSam McCall2018-09-1310-154/+103
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: The cancelable scopes are managed by JSONRPCDispatcher so that all Handlers run in cancelable contexts. (Previously ClangdServer did this, for code completion only). Cancellation request processing is therefore also in JSONRPCDispatcher. (Previously it was in ClangdLSPServer). This doesn't actually make any new commands *respect* cancellation - they'd need to check isCancelled() and bail out. But it opens the door to doing this incrementally, and putting such logic in common machinery like TUScheduler. I also rewrote the ClangdServer class/threading comments because I wanted to add to it and I got carried away. Reviewers: ilya-biryukov, kadircet Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D52004 llvm-svn: 342135
* [clangd] Clarify and hide -index flag.Eric Liu2018-09-131-4/+5
| | | | | | | | | | | | | | | Summary: The wording implies global index support, which is confusing. As most users shouldn't care about this flag, also make it hidden to avoid further confusion. Reviewers: sammccall, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51977 llvm-svn: 342134
* [clangd] Simplify cancellation public APISam McCall2018-09-136-126/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Task is no longer exposed: - task cancellation is hidden as a std::function - task creation returns the new context directly - checking is via free function only, with no way to avoid the context lookup The implementation is essentially the same, but a bit terser as it's hidden. isCancelled() is now safe to use outside any task (it returns false). This will leave us free to sprinkle cancellation in e.g. TUScheduler without needing elaborate test setup, and lets callers that don't cancel "just work". Updated the docs to describe the new expected use pattern. One thing I noticed: there's nothing async-specific about the cancellation. Async tasks can be cancelled from any thread (typically the one that created them), sync tasks can be cancelled from any *other* thread in the same way. So the docs now refer to "long-running" tasks instead of async ones. Updated usage in code complete, without any structural changes. I didn't update all the names of the helpers in ClangdLSPServer (these will likely be moved to JSONRPCDispatcher anyway). Reviewers: ilya-biryukov, kadircet Subscribers: ioeric, MaskRay, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D51996 llvm-svn: 342130
OpenPOWER on IntegriCloud