summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Don't create child AND and OR iterators with one posting listKirill Bobyrev2018-09-131-3/+7
| | | | | | | | | | | | | | `AND( AND( Child ) ... )` -> `AND( Child ... )` `AND( OR( Child ) ... )` -> `AND( Child ... )` This simple optimization results in 5-6% performance improvement in the benchmark with 2000 serialized `FuzzyFindRequest`s. Reviewed By: ilya-biryukov Differential Revision: https://reviews.llvm.org/D52016 llvm-svn: 342124
* [clangd] Rename global-symbol-builder to clangd-indexer.Ilya Biryukov2018-09-133-6/+6
| | | | | | | | | | | | | | | | | | | Summary: Given that the indexer binary is put directly into ./bin directory when built, 'clangd-' prefix seems to provide better context to the reader than 'global-'. The new name is also shorter and easier to type. Reviewers: ioeric, sammccall, kadircet Reviewed By: ioeric, sammccall Subscribers: kbobyrev, ilya-biryukov, mgorny, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D51987 llvm-svn: 342123
* [clangd] Add missing clangBasic target_link_librariesHeejin Ahn2018-09-121-0/+1
| | | | | | Without this, builds with `-DSHARED_LIB=ON` fail. llvm-svn: 342037
* [clangd] Add index benchmarksKirill Bobyrev2018-09-123-0/+127
| | | | | | | | | | | This patch introduces index benchmarks on top of the proposed LLVM benchmark pull. Reviewed By: sammccall, lebedev.ri Differential Revision: https://reviews.llvm.org/D51090 llvm-svn: 342026
* [clangd] Implement a Proof-of-Concept tool for symbol index explorationKirill Bobyrev2018-09-123-0/+177
| | | | | | | | Reviewed By: sammccall, ilya-biryukov Differential Revision: https://reviews.llvm.org/D51628 llvm-svn: 342025
* Remove unnecessary semicolon to silence -Wpedantic warning. NFCI.Simon Pilgrim2018-09-111-1/+1
| | | | llvm-svn: 341938
* [clangd] NFC: Use uint32_t for FuzzyFindRequest limitsKirill Bobyrev2018-09-112-12/+10
| | | | | | | | Reviewed By: ioeric Differential Revision: https://reviews.llvm.org/D51860 llvm-svn: 341921
* [clangd] Unbreak buildbots after r341802Kirill Bobyrev2018-09-101-1/+1
| | | | | Solution: use std::move when returning result from toJSON(...). llvm-svn: 341832
* [clangd] Implement FuzzyFindRequest JSON (de)serializationKirill Bobyrev2018-09-103-3/+33
| | | | | | | | | | | | JSON (de)serialization of `FuzzyFindRequest` might be useful for both D51090 and D51628. Also, this allows precise logging of the fuzzy find requests. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D51852 llvm-svn: 341802
* [clangd] Add symbol slab size to index memory consumption estimatesKirill Bobyrev2018-09-105-14/+32
| | | | | | | | | | | | | Currently, `SymbolIndex::estimateMemoryUsage()` returns the "overhead" estimate, i.e. the estimate of the Index data structure excluding backing data (such as Symbol Slab and Reference Slab). This patch propagates information about paired data size where necessary. Reviewed By: ioeric, sammccall Differential Revision: https://reviews.llvm.org/D51539 llvm-svn: 341800
* [clangd] Fix async index loading (from r341376).Sam McCall2018-09-101-1/+4
| | | | | | | | | | | | | | | | | | | | | Summary: This wasn't actually async (due to std::future destructor blocking). If it were, we would have clean shutdown issues if main returned and destroyed Placeholder before the thread is done with it. We could attempt to avoid any blocking by using shared_ptr or weak_ptr tricks so the thread can detect Placeholder's destruction, but there are other potential issues (e.g. loadIndex does tracing, and we'll destroy the tracer...) Instead, once LSPServer::run returns, we wait for the index to finish loading before exiting. Performance is not critical in this situation. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51674 llvm-svn: 341797
* [clangd] NFC: Rename DexIndex to DexKirill Bobyrev2018-09-105-26/+24
| | | | | | | | | | Also, cleanup some redundant includes. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D51774 llvm-svn: 341784
* [clangd] Make advanceTo() faster on Posting ListsKirill Bobyrev2018-09-101-1/+4
| | | | | | | | | | | | If the current element is already beyond advanceTo()'s DocID, just return instead of doing binary search. This simple optimization saves up to 6-7% performance, Reviewed By: ilya-biryukov Differential Revision: https://reviews.llvm.org/D51802 llvm-svn: 341781
* [clangd] Canonicalize include paths in clangd.Eric Liu2018-09-0712-24/+24
| | | | | | Get rid of "../" and "../../". llvm-svn: 341645
* [clangd] NFC: Document URIDistanceKirill Bobyrev2018-09-071-0/+1
| | | | | | | | | | | | | `URIDistance` constructor should mention that `Sources` must contain *absolute paths*, not URIs. This is not very clear when looking at the interface, especially given that `distance(...)` accepts `URI`, not an absolute path which can give the wrong impression. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D51691 llvm-svn: 341639
* [clangd] Add "Deprecated" field to Symbol and CodeCompletion.Eric Liu2018-09-0612-15/+74
| | | | | | | | | | | | | | Summary: Also set "deprecated" field in LSP CompletionItem. Reviewers: sammccall, kadircet Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D51724 llvm-svn: 341576
* [clangd] Fix Dex initializationKirill Bobyrev2018-09-062-3/+11
| | | | | | | | | | | | This patch sets URI schemes of Dex to SymbolCollector's default schemes in case callers tried to pass empty list of schemes. This was the case for initialization in Clangd main and was a reason of incorrect behavior. Also, it fixes a bug with missed `continue;` after spotting invalid URI scheme conversion. llvm-svn: 341552
* [clangd] NFC: Use TopN instead of std::priority_queueKirill Bobyrev2018-09-061-11/+7
| | | | | | | | | | | | | | Quality.cpp defines a structure for convenient storage of Top N items, it should be used instead of the `std::priority_queue` with slightly obscure semantics. This patch does not affect functionality. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D51676 llvm-svn: 341544
* [clangd] NFC: mark single-parameter constructors explicitKirill Bobyrev2018-09-061-4/+4
| | | | | | | | | | Code health: prevent implicit conversions to user-defined types. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D51690 llvm-svn: 341543
* [clangd] Implement proximity path boosting for DexKirill Bobyrev2018-09-069-44/+203
| | | | | | | | | | | | | | | This patch introduces `PathURI` Search Token kind and utilizes it to uprank symbols which are defined in files with small distance to the directory where the fuzzy find request is coming from (e.g. files user is editing). Reviewed By: ioeric Reviewers: ioeric, sammccall Differential Revision: https://reviews.llvm.org/D51481 llvm-svn: 341542
* [clangd] Set SymbolID for sema macros so that they can be merged with index ↵Eric Liu2018-09-064-13/+33
| | | | | | | | | | | | macros. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51688 llvm-svn: 341534
* [clangd] Fix type/variable name conflict on some compilersSam McCall2018-09-051-9/+8
| | | | llvm-svn: 341467
* [clangd] make zlib compression optional for binary formatSam McCall2018-09-051-11/+29
| | | | llvm-svn: 341465
* [clangd] Sort GoToDefinition results.Haojian Wu2018-09-051-33/+86
| | | | | | | | | | | | | | | | | | | | | | | Summary: GoToDefinition returns all declaration results (implicit/explicit) that are in the same location, and the results are returned in arbitrary order. Some LSP clients defaultly take the first result as the final result, which might present a bad result (implicit decl) to users. This patch ranks the result based on whether the declarations are referenced explicitly/implicitly. We put explicit declarations first. This also improves the "hover" (which just take the first result) feature in some cases. Reviewers: ilya-biryukov Subscribers: kadircet, ioeric, MaskRay, jkorous, mgrang, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D50438 llvm-svn: 341463
* [clangd] Add xrefs LSP boilerplate implementation.Sam McCall2018-09-059-0/+42
| | | | | | | | | | Reviewers: ilya-biryukov, ioeric Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D50896 llvm-svn: 341462
* [clangd] Avoid enum class+enumValN to avoid GCC bug(?), and use consistent ↵Sam McCall2018-09-052-12/+3
| | | | | | style. llvm-svn: 341459
* [clangd] Implement findReferences functionSam McCall2018-09-052-78/+127
| | | | | | clangd will use findReferences to provide LSP's reference feature. llvm-svn: 341458
* [clangd] Fix typo. NFCFangrui Song2018-09-054-4/+4
| | | | llvm-svn: 341452
* [clangd] Fix buildbot failures on older compilers from r341375Sam McCall2018-09-052-7/+7
| | | | llvm-svn: 341451
* [clangd] Tune macro quality scoring for code completion.Eric Liu2018-09-051-1/+1
| | | | | | | | x0.2 seems to be too much penalty, macros might be wanted in some cases; changing to 0.5x instead. The tuning didn't affect ranking for non-macro completions. llvm-svn: 341449
* [clangd] Load static index asynchronously, add tracing.Sam McCall2018-09-043-6/+19
| | | | | | | | | | | | | | Summary: Like D51475 but simplified based on recent patches. While here, clarify that loadIndex() takes a filename, not file content. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51638 llvm-svn: 341376
* [clangd] Define a compact binary serialization fomat for symbol slab/index.Sam McCall2018-09-0410-53/+669
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This is intended to replace the current YAML format for general use. It's ~10x more compact than YAML, and ~40% more compact than gzipped YAML: llvmidx.riff = 20M, llvmidx.yaml = 272M, llvmidx.yaml.gz = 32M It's also simpler/faster to read and write. The format is a RIFF container (chunks of (type, size, data)) with: - a compressed string table - simple binary encoding of symbols (with varints for compactness) It can be extended to include occurrences, Dex posting lists, etc. There's no rich backwards-compatibility scheme, but a version number is included so we can detect incompatible files and do ad-hoc back-compat. Alternatives considered: - compressed YAML or JSON: bulky and slow to load - llvm bitstream: confusing model and libraries are hard to use. My attempt produced slightly larger files, and the code was longer and slower. - protobuf or similar: would be really nice (esp for back-compat) but the dependency is a big hassle - ad-hoc binary format without a container: it seems clear we're going to add posting lists and occurrences here, and that they will benefit from sharing a string table. The container makes it easy to debug these pieces in isolation, and make them optional. Reviewers: ioeric Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51585 llvm-svn: 341375
* [clangd] NFC: Change quality type to floatKirill Bobyrev2018-09-042-2/+2
| | | | | | | | Reviewed by: sammccall Differential Revision: https://reviews.llvm.org/D51636 llvm-svn: 341374
* [clangd] Move buildStaticIndex() to SymbolYAMLKirill Bobyrev2018-09-043-23/+25
| | | | | | | | | | | | | | `buildStaticIndex()` is used by two other tools that I'm building, now it's useful outside of `tool/ClangdMain.cpp`. Also, slightly refactor the code while moving it to the different source file. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D51626 llvm-svn: 341369
* [clangd] SymbolOccurrences -> Refs and cleanupSam McCall2018-09-0414-254/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A few things that I noticed while merging the SwapIndex patch: - SymbolOccurrences and particularly SymbolOccurrenceSlab are unwieldy names, and these names appear *a lot*. Ref, RefSlab, etc seem clear enough and read/format much better. - The asymmetry between SymbolSlab and RefSlab (build() vs freeze()) is confusing and irritating, and doesn't even save much code. Avoiding RefSlab::Builder was my idea, but it was a bad one; add it. - DenseMap<SymbolID, ArrayRef<Ref>> seems like a reasonable compromise for constructing MemIndex - and means many less wasted allocations than the current DenseMap<SymbolID, vector<Ref*>> for FileIndex, and none for slabs. - RefSlab::find() is not actually used for anything, so we can throw away the DenseMap and keep the representation much more compact. - A few naming/consistency fixes: e.g. Slabs,Refs -> Symbols,Refs. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51605 llvm-svn: 341368
* Remove lambda default parameter to silence -Wpedantic warning. NFCI.Simon Pilgrim2018-09-041-3/+3
| | | | llvm-svn: 341362
* [clangd] Fix index-twice regression from r341242Sam McCall2018-09-031-1/+0
| | | | llvm-svn: 341337
* [clangd] Some nitpicking around the new split (preamble/main) dynamic indexSam McCall2018-09-038-50/+76
| | | | | | | | | | | | | | | | | | | | | | Summary: - DynamicIndex doesn't implement ParsingCallbacks, to make its role clearer. ParsingCallbacks is a separate object owned by the receiving TUScheduler. (I tried to get rid of the "index-like-object that doesn't implement index" but it was too messy). - Clarified(?) docs around DynamicIndex - fewer details up front, more details inside. - Exposed dynamic index from ClangdServer for memory monitoring and more direct testing of its contents (actual tests not added here, wanted to get this out for review) - Removed a redundant and sligthly confusing filename param in a callback Reviewers: ilya-biryukov Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51221 llvm-svn: 341325
* [clangd] Avoid crashes in override completionsIlya Biryukov2018-09-031-3/+3
| | | | | | | | | | | | | | Summary: NamedDecl::getName cannot be called on non-identifier names. Reviewers: kadircet, ioeric, hokein, sammccall Reviewed By: ioeric Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D51598 llvm-svn: 341322
* [clangd] Handle errors before checking for cancelltionIlya Biryukov2018-09-031-3/+2
| | | | | | To avoid hitting assertions in llvm::Expected destructor. llvm-svn: 341319
* [clangd] Factor out the data-swapping functionality from MemIndex/DexIndex.Sam McCall2018-09-038-299/+233
| | | | | | | | | | | | | | | | | | | | | | | Summary: This is now handled by a wrapper class SwapIndex, so MemIndex/DexIndex can be immutable and focus on their job. Old and busted: I have a MemIndex, which holds a shared_ptr<vector<Symbol*>>, which keeps the symbol slab alive. I update by calling build(shared_ptr<vector<Symbol*>>). New hotness: I have a SwapIndex, which holds a unique_ptr<SymbolIndex>, which holds a MemIndex, which holds a shared_ptr<void>, which keeps backing data alive. I update by building a new MemIndex and calling SwapIndex::reset(). Reviewers: kbobyrev, ioeric Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51422 llvm-svn: 341318
* [clangd] Support multiple #include headers in one symbol.Eric Liu2018-09-037-52/+150
| | | | | | | | | | | | | | | | | | | | Summary: Currently, a symbol can have only one #include header attached, which might not work well if the symbol can be imported via different #includes depending on where it's used. This patch stores multiple #include headers (with # references) for each symbol, so that CodeCompletion can decide which include to insert. In this patch, code completion simply picks the most popular include as the default inserted header. We also return all possible includes and their edits in the `CodeCompletion` results. Reviewers: sammccall Reviewed By: sammccall Subscribers: mgrang, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51291 llvm-svn: 341304
* [clangd] Fix many typos. NFCFangrui Song2018-09-019-10/+10
| | | | llvm-svn: 341273
* [clangd] Implement findOccurrences interface in dynamic index.Haojian Wu2018-08-318-30/+169
| | | | | | | | | | | | | | | | | | | | Summary: Implement the interface in - FileIndex - MemIndex - MergeIndex Depends on https://reviews.llvm.org/D50385. Reviewers: sammccall, ilya-biryukov Reviewed By: sammccall Subscribers: mgrang, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51279 llvm-svn: 341242
* [clangd] Flatten out Symbol::Details. It was ill-conceived, sorry.Sam McCall2018-08-319-126/+49
| | | | | | | | | | Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51504 llvm-svn: 341211
* [clangd] Collect symbol occurrences in SymbolCollector.Haojian Wu2018-08-314-22/+192
| | | | | | | | | | SymbolCollector will be used for two cases: - collect Symbol type only, used for indexing preamble AST. - collect Symbol and SymbolOccurrences, used for indexing main AST. For finding local references from the AST, we will implement it in other ways. llvm-svn: 341208
* [NFC] Cleanup DexKirill Bobyrev2018-08-314-30/+33
| | | | | | | | | | | | | * Use consistent assertion messages in iterators implementations * Silence a bunch of clang-tidy warnings: use `emplace_back` instead of `push_back` where possible, make sure arguments have the same name in header and implementation file, use for loop over ranges where possible Reviewed by: ioeric Differential Revision: https://reviews.llvm.org/D51528 llvm-svn: 341190
* NFC: Fix build failure after rL341182Kirill Bobyrev2018-08-311-1/+1
| | | | | | Didn't rename another variable reference. llvm-svn: 341184
* [NFC] Use LLVM naming conventions within FileDistanceKirill Bobyrev2018-08-312-5/+5
| | | | | | | | Reviewed by: sammccall Differential Revision: https://reviews.llvm.org/D51527 llvm-svn: 341182
* [clangd] Run SignatureHelp using an up-to-date preamble, waiting if needed.Sam McCall2018-08-303-21/+85
| | | | | | | | | | | | | | Summary: After code completion inserts a header, running signature help using the old preamble will usually fail. So we add support for consistent preamble reads. Reviewers: ilya-biryukov Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D51438 llvm-svn: 341076
OpenPOWER on IntegriCloud