summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd
Commit message (Collapse)AuthorAgeFilesLines
* [clangd] Simplify code. No functionality change intended.Benjamin Kramer2017-12-287-34/+23
| | | | llvm-svn: 321523
* [clangd] Skip function bodies when building the preambleIlya Biryukov2017-12-281-0/+10
| | | | | | | | | | | | | | Summary: To make building preambles faster and keep them smaller. Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D41495 llvm-svn: 321521
* [clangd] Use Builder for symbol slabs, and use sorted-vector for storageSam McCall2017-12-237-81/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This improves a few things: - the insert -> freeze -> read sequence is now enforced/communicated by the type system - SymbolSlab::const_iterator iterates over symbols, not over id-symbol pairs - we avoid permanently storing a second copy of the IDs, and the string map's hashtable The slab size is now down to 21.8MB for the LLVM project. Of this only 2.7MB is strings, the rest is #symbols * `sizeof(Symbol)`. `sizeof(Symbol)` is currently 96, which seems too big - I think SymbolInfo isn't efficiently packed. That's a topic for another patch! Also added simple API to see the memory usage/#symbols of a slab, since it seems likely we will continue to care about this. Reviewers: ilya-biryukov Subscribers: klimek, mgrang, cfe-commits Differential Revision: https://reviews.llvm.org/D41506 llvm-svn: 321412
* [clangd] Add a tool to build YAML-format global symbols.Haojian Wu2017-12-223-0/+130
| | | | | | | | | | | | | | | | | | | | | | Summary: The tools is used to generate global symbols for clangd (global code completion), The format is YAML, which is only for **experiment**. Usage: ./bin/global-symbol-builder </path/to/llvm-dir> > global-symbols.yaml TEST: used the tool to generate global symbols for LLVM (~72MB). Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, mgorny, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41491 llvm-svn: 321358
* [clangd] Simplify GlobalCompilationDatabase, cache missing GCDsSam McCall2017-12-222-47/+23
| | | | llvm-svn: 321350
* [clangd] Improve packing of Symbol struct. NFCSam McCall2017-12-222-4/+10
| | | | llvm-svn: 321348
* [clangd] Don't re-hash SymbolID in maps, just use the SHA1 dataSam McCall2017-12-212-2/+4
| | | | llvm-svn: 321302
* [clangd] Fix use after free.Benjamin Kramer2017-12-211-3/+4
| | | | | | Found by asan. llvm-svn: 321286
* [clangd] Index symbols share storage within a slab.Sam McCall2017-12-212-11/+30
| | | | | | | | | | | | | | | | | Summary: Symbols are not self-contained - it's only safe to hand them out if you guarantee the lifetime of the underlying data. Before this lands, I'm going to measure the before/after memory usage of the LLVM index loaded into memory in a single slab. Reviewers: hokein Subscribers: klimek, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41483 llvm-svn: 321272
* [clangd] Log more info about preamblesIlya Biryukov2017-12-211-2/+10
| | | | llvm-svn: 321267
* [clangd] Use the clang-tools-extra as the official repo for `vscode-clangd` ↵Haojian Wu2017-12-214-15/+88
| | | | | | | | | | | | | | | | | | | | | | | extension. Summary: Previously, we use a separate GitHub repository (https://github.com/llvm-vs-code-extensions/vscode-clangd) for publishing `vscode-clangd` extension to marketplace. To reduce the maintain burden, we will use the vscode extension in the clang-tools-extra, and deprecate the one on GitHub. Test in https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.clangd-vscode-test Reviewers: sammccall, krasimir Reviewed By: sammccall Subscribers: klimek, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41391 llvm-svn: 321252
* [clangd-fuzzer] Update ClangdLSPServer constructor call.Matt Morehouse2017-12-201-1/+2
| | | | | | Build was broken by r321092. llvm-svn: 321226
* [clangd] Pull CodeCompletionString handling logic into its own file and add ↵Eric Liu2017-12-204-210/+249
| | | | | | | | | | | | unit test. Reviewers: sammccall Subscribers: klimek, mgorny, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41450 llvm-svn: 321193
* [clangd] Made UniqueFunction's bool conversion explicitIlya Biryukov2017-12-201-1/+1
| | | | llvm-svn: 321173
* [clangd] Add debug printers for basic protocol types. NFCSam McCall2017-12-202-0/+23
| | | | llvm-svn: 321161
* [clangd] Igore cases in index fuzzy find.Eric Liu2017-12-201-1/+1
| | | | llvm-svn: 321157
* [clangd] Add "../" to Logger.h included from parent directory.Martin Bohme2017-12-201-1/+1
| | | | llvm-svn: 321156
* [clangd] Don't use the optional "severity" when comparing Diagnostic.Haojian Wu2017-12-192-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: We use Diagnostic as a key to find the corresponding FixIt when we do the "apply-fix", but the "severity" field could be omitted, in some cases, the codeAction request sent from LSP clients (e.g. VScode) doesn't include the `severity` field, which makes clangd fail to find the FixIt. Test the following code in VScode, before the fix, no FixIt shown. ``` void main() {} ^~~~ ``` Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41280 llvm-svn: 321106
* [clangd] Supress a log warning by putting it behind a condition.Eric Liu2017-12-191-2/+3
| | | | llvm-svn: 321094
* [clangd] Build dynamic index and use it for code completion.Eric Liu2017-12-199-15/+67
| | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41289 llvm-svn: 321092
* [clangd] Split findDefs/highlights into XRefs, from ClangdUnit. NFCSam McCall2017-12-196-260/+307
| | | | | | | | | Going to add unit tests in the next patch. (Haha!) But seriously there's some work to do first - need to extract the markers-in-source-code parser from CodeComplete test and make it more flexible, to allow annotated ranges etc. llvm-svn: 321087
* [clangd] Fix warnings/compiler pickiness after r321083Sam McCall2017-12-191-1/+1
| | | | llvm-svn: 321086
* [clangd] Index-based code completion.Eric Liu2017-12-197-27/+192
| | | | | | | | | | | | | | Summary: Use symbol index to populate completion results for qualfified IDs e.g. "nx::A^". Reviewers: ilya-biryukov, sammccall Reviewed By: ilya-biryukov, sammccall Subscribers: rwols, klimek, mgorny, cfe-commits, sammccall Differential Revision: https://reviews.llvm.org/D41281 llvm-svn: 321083
* [clangd] Expose offset <-> LSP position functions, and fix bugsSam McCall2017-12-196-30/+74
| | | | | | | | | | | | | | | | | | | | | | | Summary: - Moved these functions to SourceCode.h - added unit tests - fix off by one in positionToOffset: Offset - 1 in final calculation was wrong - fixed formatOnType which had an equal and opposite off-by-one - positionToOffset and offsetToPosition both consistently clamp to beginning/end of file when input is out of range - gave variables more descriptive names - removed windows line ending fixmes where there is nothing to fix - elaborated on UTF-8 fixmes This will conflict with Eric's D41281, but in a pretty easy-to-resolve way. Reviewers: ioeric Subscribers: klimek, mgorny, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41351 llvm-svn: 321073
* [clangd] Support filtering by fixing scopes in fuzzyFind.Eric Liu2017-12-194-13/+50
| | | | | | | | | | | | | | Summary: When scopes are specified, only match symbols from scopes. Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41367 llvm-svn: 321067
* [clangd] in VSCode client, filter extensions properly and only accept file: URIsSam McCall2017-12-181-4/+4
| | | | | | | | | | | | | | | | | | | Summary: The filtering wasn't previously working as intended - the string list is interpreted as a list of editor modes, not file extensions. (It happens to mostly work as "c" and "cpp" are the names of modes, but we're missing objective-c) The file: restriction is new - clangd needs to be able to convert URI<->path in order to determine how to build. Reviewers: hokein Subscribers: klimek, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41343 llvm-svn: 320972
* [clangd] Build in-memory index on symbols in files.Eric Liu2017-12-153-10/+66
| | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, mgorny, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41276 llvm-svn: 320807
* [clangd] Put all #includes in one block in clangd source files. NFCEric Liu2017-12-1415-23/+10
| | | | | | | Clang-format categorizes and sorts #includes with style. It doesn't make sense to manually managing #include blocks. llvm-svn: 320743
* [clangd] Changed tracing interfacesIlya Biryukov2017-12-142-24/+44
| | | | | | | | | | | | | | | | | Summary: EventTracer interface now contains two methods: - spanEvent for events that have duration, - instant for events that are instant. Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, luckygeck, cfe-commits Differential Revision: https://reviews.llvm.org/D40489 llvm-svn: 320708
* [clangd] Implemented tracing using ContextIlya Biryukov2017-12-145-55/+85
| | | | | | | | | | | | Reviewers: sammccall, ioeric, hokein Reviewed By: sammccall Subscribers: klimek, luckygeck, cfe-commits Differential Revision: https://reviews.llvm.org/D40488 llvm-svn: 320706
* [clangd] Add a FileSymbols container that manages symbols from multiple files.Eric Liu2017-12-143-1/+103
| | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, mgorny, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41232 llvm-svn: 320701
* [clangd] Construct SymbolSlab from YAML format.Haojian Wu2017-12-145-6/+210
| | | | | | | | | | | | | | Summary: This will be used together with D40548 for the global index source (experimental). Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, mgorny, ilya-biryukov, cfe-commits, ioeric Differential Revision: https://reviews.llvm.org/D41178 llvm-svn: 320694
* [clangd] Symbol index interfaces and an in-memory index implementation.Eric Liu2017-12-144-0/+123
| | | | | | | | | | | | | | | | | | | | Summary: o Index interfaces to support using different index sources (e.g. AST index, global index) for code completion, cross-reference finding etc. This patch focuses on code completion. The following changes in the original patch has been split out. o Implement an AST-based index. o Add an option to replace sema code completion for qualified-id with index-based completion. o Implement an initial naive code completion index which matches symbols that have the query string as substring. Reviewers: malaperle, sammccall Reviewed By: sammccall Subscribers: hokein, klimek, malaperle, mgorny, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D40548 llvm-svn: 320688
* [clangd] Fix bool conversion operator of UniqueFunctionIlya Biryukov2017-12-131-1/+1
| | | | | | | Usages of it were giving compiler errors because of the missing explicit conversion. llvm-svn: 320591
* [clangd] Try to workaround MSVC compilation failure.Ilya Biryukov2017-12-131-0/+5
| | | | llvm-svn: 320578
* [clangd] clang-format the source code. NFCIlya Biryukov2017-12-133-19/+10
| | | | llvm-svn: 320577
* [clangd] Implemented logging using ContextIlya Biryukov2017-12-1319-333/+414
| | | | | | | | | | | | Reviewers: sammccall, ioeric, hokein Reviewed By: sammccall Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D40486 llvm-svn: 320576
* [clangd] Remove the const specifier of the takeSymbol methodHaojian Wu2017-12-131-1/+1
| | | | | | otherwise we will copy an object. llvm-svn: 320574
* [clangd] Emit ranges for clangd diagnostics, and fix off-by-one positionsSam McCall2017-12-134-25/+83
| | | | | | | | | | | | | | | | | | | Summary: - when the diagnostic has an explicit range, we prefer that - if the diagnostic has a fixit, its RemoveRange is our next choice - otherwise we try to expand the diagnostic location into a whole token. (inspired by VSCode, which does this client-side when given an empty range) - if all else fails, we return the zero-width range as now. (clients react in different ways to this, highlighting a token or a char) - this includes the off-by-one fix from D40860, and borrows heavily from it Reviewers: rwols, hokein Subscribers: klimek, ilya-biryukov, cfe-commits Differential Revision: https://reviews.llvm.org/D41118 llvm-svn: 320555
* [clangd] Overload hash_value for SymbolID, fix struct/class warningSam McCall2017-12-131-3/+5
| | | | llvm-svn: 320554
* [clangd] (Attempt to) read clang-format file for document formattingRaoul Wols2017-12-123-36/+75
| | | | | | | | | | | | | | | | | Summary: Takes into account the clang-format file of the project, if any. Reverts to LLVM if nothing is found. Replies with an error if any error occured. For instance, a parse error in the clang-format YAML file. Reviewers: ilya-biryukov, sammccall, Nebiroth, malaperle, krasimir Reviewed By: sammccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41031 llvm-svn: 320524
* [clangd] Introduce a "Symbol" class.Haojian Wu2017-12-125-0/+332
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: * The "Symbol" class represents a C++ symbol in the codebase, containing all the information of a C++ symbol needed by clangd. clangd will use it in clangd's AST/dynamic index and global/static index (code completion and code navigation). * The SymbolCollector (another IndexAction) will be used to recollect the symbols when the source file is changed (for ASTIndex), or to generate all C++ symbols for the whole project. In the long term (when index-while-building is ready), clangd should share a same "Symbol" structure and IndexAction with index-while-building, but for now we want to have some stuff working in clangd. Reviewers: ioeric, sammccall, ilya-biryukov, malaperle Reviewed By: sammccall Subscribers: malaperle, klimek, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D40897 llvm-svn: 320486
* [clangd] Removed unused variable. NFCIlya Biryukov2017-12-121-1/+1
| | | | llvm-svn: 320482
* [clangd] clang-format the code. NFCIlya Biryukov2017-12-122-3/+2
| | | | llvm-svn: 320476
* [clangd] Document highlights for clangdIlya Biryukov2017-12-1210-46/+271
| | | | | | | | | | | | | | | | | Summary: Implementation of Document Highlights Request as described in LSP. Contributed by William Enright (nebiroth). Reviewers: malaperle, krasimir, bkramer, ilya-biryukov Reviewed By: malaperle Subscribers: mgrang, sammccall, klimek, ioeric, rwols, cfe-commits, arphaman, ilya-biryukov Differential Revision: https://reviews.llvm.org/D38425 llvm-svn: 320474
* [clangd] Introduced a Context that stores implicit dataIlya Biryukov2017-12-123-0/+211
| | | | | | | | | | | | | | | | Summary: It will be used to pass around things like Logger and Tracer throughout clangd classes. Reviewers: sammccall, ioeric, hokein, bkramer Reviewed By: sammccall Subscribers: klimek, bkramer, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D40485 llvm-svn: 320468
* [clangd-fuzzer] Update contruction of LSPServer.Matt Morehouse2017-12-071-1/+4
| | | | | | | The constructor for ClangdLSPServer changed in r318412 and r318925, breaking the clangd-fuzzer build. llvm-svn: 320074
* [CMake] Use PRIVATE in target_link_libraries for fuzzers.Matt Morehouse2017-12-061-0/+1
| | | | | | Several fuzzers were missed by r319840. llvm-svn: 319948
* [CMake] Use PRIVATE in target_link_libraries for executablesShoaib Meenai2017-12-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently use target_link_libraries without an explicit scope specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables. Dependencies added in this way apply to both the target and its dependencies, i.e. they become part of the executable's link interface and are transitive. Transitive dependencies generally don't make sense for executables, since you wouldn't normally be linking against an executable. This also causes issues for generating install export files when using LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM library dependencies, which are currently added as interface dependencies. If clang is in the distribution components but the LLVM libraries it depends on aren't (which is a perfectly legitimate use case if the LLVM libraries are being built static and there are therefore no run-time dependencies on them), CMake will complain about the LLVM libraries not being in export set when attempting to generate the install export file for clang. This is reasonable behavior on CMake's part, and the right thing is for LLVM's build system to explicitly use PRIVATE dependencies for executables. Unfortunately, CMake doesn't allow you to mix and match the keyword and non-keyword target_link_libraries signatures for a single target; i.e., if a single call to target_link_libraries for a particular target uses one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must also be updated to use those keywords. This means we must do this change in a single shot. I also fully expect to have missed some instances; I tested by enabling all the projects in the monorepo (except dragonegg), and configuring both with and without shared libraries, on both Darwin and Linux, but I'm planning to rely on the buildbots for other configurations (since it should be pretty easy to fix those). Even after this change, we still have a lot of target_link_libraries calls that don't specify a scope keyword, mostly for shared libraries. I'm thinking about addressing those in a follow-up, but that's a separate change IMO. Differential Revision: https://reviews.llvm.org/D40823 llvm-svn: 319840
* [clangd] Set completion options per-request.Ilya Biryukov2017-12-054-20/+24
| | | | | | | | | | | | | | | | | | | | Summary: Previously, completion options were set per ClangdServer instance. It will allow to change completion preferences during the lifetime of a single ClangdServer instance. Also rewrote ClangdCompletionTest.CompletionOptions to reuse single ClangdServer instance, the test now runs 2x faster on my machine. Reviewers: sammccall, ioeric, hokein Reviewed By: sammccall, ioeric Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D40654 llvm-svn: 319753
OpenPOWER on IntegriCloud