summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/index
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Move the utility function to anonymous namespace, NFC.Haojian Wu2018-12-131-32/+33
| | | | llvm-svn: 349031
* [clangd] Partition include graph on auto-index.Kadir Cetinkaya2018-12-041-45/+68
| | | | | | | | | | | | | | Summary: Partitions include graphs in auto-index so that each shards contains only part of the include graph related to itself. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55062 llvm-svn: 348252
* [clangd] Fix a stale comment, NFC.Haojian Wu2018-12-032-3/+2
| | | | llvm-svn: 348133
* [clangd] Populate include graph during static indexing action.Kadir Cetinkaya2018-11-303-12/+123
| | | | | | | | | | | | | | | Summary: This is the second part for introducing include hierarchy into index files produced by clangd. You can see the base patch that introduces structures and discusses the future of the patches in D54817 Reviewers: ilya-biryukov Subscribers: mgorny, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D54999 llvm-svn: 348005
* [clangd][NFC] Move SymbolID to a separate fileJan Korous2018-11-274-77/+124
| | | | | | | | Prerequisity for textDocument/SymbolInfo Differential Revision: https://reviews.llvm.org/D54799 llvm-svn: 347674
* [clangd] Put direct headers into srcs section.Kadir Cetinkaya2018-11-274-42/+83
| | | | | | | | | | | | | | | | | | | Summary: Currently, there's no way of knowing about header files using compilation database, since it doesn't contain header files as entries. Using this information, restoring from cache using compile commands becomes possible instead of doing directory traversal. Also, we can issue indexing actions for out-of-date headers even if source files depending on them haven't changed. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D54817 llvm-svn: 347669
* [clangd] Enable auto-index behind a flag.Sam McCall2018-11-263-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Ownership and configuration: The auto-index (background index) is maintained by ClangdServer, like Dynamic. (This means ClangdServer will be able to enqueue preamble indexing in future). For now it's enabled by a simple boolean flag in ClangdServer::Options, but we probably want to eventually allow injecting the storage strategy. New 'sync' command: In order to meaningfully test the integration (not just unit-test components) we need a way for tests to ensure the asynchronous index reads/writes occur before a certain point. Because these tests and assertions are few, I think exposing an explicit "sync" command for use in tests is simpler than allowing threading to be completely disabled in the background index (as we do for TUScheduler). Bugs: I fixed a couple of trivial bugs I found while testing, but there's one I can't. JSONCompilationDatabase::getAllFiles() may return relative paths, and currently we trigger an assertion that assumes they are absolute. There's no efficient way to resolve them (you have to retrieve the corresponding command and then resolve against its directory property). In general I think this behavior is broken and we should fix it in JSONCompilationDatabase and require CompilationDatabase::getAllFiles() to be absolute. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D54894 llvm-svn: 347567
* [clangd] Fix use-after-free with expected types in indexingIlya Biryukov2018-11-261-2/+4
| | | | llvm-svn: 347563
* [clangd] Add type boosting in code completionIlya Biryukov2018-11-261-0/+2
| | | | | | | | | | | | Reviewers: sammccall, ioeric Reviewed By: sammccall Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52276 llvm-svn: 347562
* [clangd] Collect and store expected types in the indexIlya Biryukov2018-11-264-1/+15
| | | | | | | | | | | | | | | | | | | | Summary: And add a hidden option to control whether the types are collected. For experiments, will be removed when expected types implementation is stabilized. The index size is almost unchanged, e.g. the YAML index for all clangd sources increased from 53MB to 54MB. Reviewers: ioeric, sammccall Reviewed By: sammccall Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52274 llvm-svn: 347560
* [clangd] Fix missing include from r347538 - fix windows buildbotsSam McCall2018-11-261-0/+1
| | | | llvm-svn: 347554
* [clangd] Auto-index watches global CDB for changes.Sam McCall2018-11-263-41/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Instead of receiving compilation commands, auto-index is triggered by just filenames to reindex, and gets commands from the global comp DB internally. This has advantages: - more of the work can be done asynchronously (fetching compilation commands upfront can be slow for large CDBs) - we get access to the CDB which can be used to retrieve interpolated commands for headers (useful in some cases where the original TU goes away) - fits nicely with the filename-only change observation from r347297 The interface to GlobalCompilationDatabase gets extended: when retrieving a compile command, the GCDB can optionally report the project the file belongs to. This naturally fits together with getCompileCommand: it's hard to implement one without the other. But because most callers don't care, I've ended up with an awkward optional-out-param-in-virtual method pattern - maybe there's a better one. This is the main missing integration point between ClangdServer and BackgroundIndex, after this we should be able to add an auto-index flag. Reviewers: ioeric, kadircet Subscribers: MaskRay, jkorous, arphaman, cfe-commits, ilya-biryukov Differential Revision: https://reviews.llvm.org/D54865 llvm-svn: 347538
* [clangd] Cleanup: stop passing around list of supported URI schemes.Eric Liu2018-11-2211-95/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Instead of passing around a list of supported URI schemes in clangd, we expose an interface to convert a path to URI using any compatible scheme that has been registered. It favors customized schemes and falls back to "file" when no other scheme works. Changes in this patch are: - URI::create(AbsPath, URISchemes) -> URI::create(AbsPath). The new API finds a compatible scheme from the registry. - Remove URISchemes option everywhere (ClangdServer, SymbolCollecter, FileIndex etc). - Unit tests will use "unittest" by default. - Move "test" scheme from ClangdLSPServer to ClangdMain.cpp, and only register the test scheme when lit-test or enable-lit-scheme is set. (The new flag is added to make lit protocol.test work; I wonder if there is alternative here.) Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54800 llvm-svn: 347467
* Address comments.Kadir Cetinkaya2018-11-192-5/+7
| | | | llvm-svn: 347237
* Use digest size instead of hardcoding it.Kadir Cetinkaya2018-11-191-1/+1
| | | | llvm-svn: 347236
* [clangd] Store source file hash in IndexFile{In,Out}Kadir Cetinkaya2018-11-193-0/+18
| | | | | | | | | | | | | | Summary: Puts the digest of the source file that generated the index into serialized index and stores them back on load, if exists. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D54693 llvm-svn: 347235
* [clangd] Truncate SymbolID to 8 bytes.Haojian Wu2018-11-162-4/+3
| | | | | | | | | | | | | | Summary: This is our goal. It has a non-zero rick, but so far we haven't see any collision (externally and internally). Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54622 llvm-svn: 347044
* [clangd] Fix a compiler warning and test crashes caused in rL347038.Haojian Wu2018-11-162-1/+3
| | | | llvm-svn: 347039
* Introduce shard storage to auto-index.Kadir Cetinkaya2018-11-163-24/+193
| | | | | | | | | | | | Reviewers: sammccall, ioeric Reviewed By: sammccall Subscribers: llvm-commits, mgorny, Eugene.Zelenko, ilya-biryukov, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D54269 llvm-svn: 347038
* [clangd] global-symbol-builder => clangd-indexerHaojian Wu2018-11-151-1/+1
| | | | llvm-svn: 346955
* [clangd] Fix no results returned for global symbols in dexpHaojian Wu2018-11-151-0/+4
| | | | | | | | | | | | | | Summary: For symbols in global namespace (without any scope), we need to add global scope "" to the fuzzy request. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54519 llvm-svn: 346947
* Revert "Introduce shard storage to auto-index."Kadir Cetinkaya2018-11-152-159/+25
| | | | | | This reverts commit 6dd1f24aead10a8d375d0311001987198d26e900. llvm-svn: 346945
* Revert "clang-format"Kadir Cetinkaya2018-11-151-2/+2
| | | | | | This reverts commit 0a37e9c3d88a2e21863657df2f7735fb7e5f746e. llvm-svn: 346944
* Revert "Address comments"Kadir Cetinkaya2018-11-152-164/+129
| | | | | | This reverts commit 19a39b14eab2b5339325e276262b177357d6b412. llvm-svn: 346943
* Revert "Address comments."Kadir Cetinkaya2018-11-152-70/+109
| | | | | | This reverts commit b43c4d1c731e07172a382567f3146b3c461c5b69. llvm-svn: 346942
* Address comments.Kadir Cetinkaya2018-11-152-109/+70
| | | | llvm-svn: 346941
* Address commentsKadir Cetinkaya2018-11-152-129/+164
| | | | llvm-svn: 346940
* clang-formatKadir Cetinkaya2018-11-151-2/+2
| | | | llvm-svn: 346939
* Introduce shard storage to auto-index.Kadir Cetinkaya2018-11-152-25/+159
| | | | | | | | | | Reviewers: sammccall, ioeric Subscribers: ilya-biryukov, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D54269 llvm-svn: 346938
* [clangd] Replace StringRef in SymbolLocation with a char pointer.Haojian Wu2018-11-147-20/+62
| | | | | | | | | | | | | | | | | Summary: This would save us 8 bytes per ref, and buy us ~40MB in total for llvm index (from ~300MB to ~260 MB). The char pointer must be null-terminated, and llvm::StringSaver guarantees it. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53427 llvm-svn: 346852
* [clangd] Don't show all refs results if -name is ambiguous in dexp.Haojian Wu2018-11-121-0/+6
| | | | | | | | | | Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54430 llvm-svn: 346671
* [clangd] Allow symbols from AnyScope in dexp.Haojian Wu2018-11-121-0/+1
| | | | | | | | | | | | | | Summary: We should allow symbols from any scope in dexp results, othewise `find StringRef` doesn't return any results (llvm::StringRef). Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54427 llvm-svn: 346666
* [clangd] Remember to serialize AnyScope in FuzzyFindRequest json.Eric Liu2018-11-121-1/+2
| | | | llvm-svn: 346648
* [clangd] Drop namespace references in the index.Haojian Wu2018-11-072-1/+4
| | | | | | | | | | | | | | | | | | | Summary: Namespace references is less useful compared with other symbols, and they contribute large part of the index. This patch drops them. The number of refs is reduced from 5.4 million to 4.7 million. | | Before | After | |file size | 78 MB | 71MB | |memory | 330MB | 300MB| Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D54202 llvm-svn: 346319
* [clangd] [NFC] Fix clang-tidy warnings.Kadir Cetinkaya2018-11-071-1/+1
| | | | | | | | | | Reviewers: ioeric, sammccall, ilya-biryukov, hokein Subscribers: MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D54157 llvm-svn: 346308
* [clangd] Get rid of QueryScopes.empty() == AnyScope special case.Eric Liu2018-11-063-6/+2
| | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53933 llvm-svn: 346223
* [clangd] auto-index stores symbols per-file instead of per-TU.Eric Liu2018-11-067-42/+278
| | | | | | | | | | | | | | | | | Summary: This allows us to deduplicate header symbols across TUs. File digests are collects when collecting symbols/refs. And the index store deduplicates file symbols based on the file digest. Reviewers: sammccall, hokein Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53433 llvm-svn: 346221
* [clangd] Use thread pool for background indexing.Kadir Cetinkaya2018-10-302-7/+22
| | | | | | | | | | | | Reviewers: sammccall, ioeric Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D53651 llvm-svn: 345590
* [clangd] Do not query index for new name completions.Kadir Cetinkaya2018-10-241-1/+1
| | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D53192 llvm-svn: 345153
* [clangd] Hide position line and column fields.Haojian Wu2018-10-241-2/+1
| | | | | | | | | | Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53577 llvm-svn: 345134
* [clangd] Truncate SymbolID to 16 bytes.Sam McCall2018-10-243-7/+13
| | | | | | | | | | | | | | | Summary: The goal is 8 bytes, which has a nonzero risk of collisions with huge indexes. This patch should shake out any issues with truncation at all, we can lower further later. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53587 llvm-svn: 345113
* [clangd] Support URISchemes configuration in BackgroundIndex.Eric Liu2018-10-222-4/+9
| | | | | | | | | | Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53503 llvm-svn: 344912
* [clangd] Fix unqualified make_unique after r344850. NFCSam McCall2018-10-201-2/+2
| | | | llvm-svn: 344858
* [clangd] Namespace style cleanup in cpp files. NFC.Sam McCall2018-10-2015-207/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Standardize on the most common namespace setup in our *.cpp files: using namespace llvm; namespace clang { namespace clangd { void foo(StringRef) { ... } And remove redundant llvm:: qualifiers. (Except for cases like make_unique where this causes problems with std:: and ADL). This choice is pretty arbitrary, but some broad consistency is nice. This is going to conflict with everything. Sorry :-/ Squash the other configurations: A) using namespace llvm; using namespace clang; using namespace clangd; void clangd::foo(StringRef); This is in some of the older files. (It prevents accidentally defining a new function instead of one in the header file, for what that's worth). B) namespace clang { namespace clangd { void foo(llvm::StringRef) { ... } This is fine, but in practice the using directive often gets added over time. C) namespace clang { namespace clangd { using namespace llvm; // inside the namespace This was pretty common, but is a bit misleading: name lookup preferrs clang::clangd::foo > clang::foo > llvm:: foo (no matter where the using directive is). llvm-svn: 344850
* Fix MSVC "not all control paths return a value" warning. NFCI.Simon Pilgrim2018-10-201-0/+1
| | | | llvm-svn: 344844
* [clangd] Remove the overflow log.Haojian Wu2018-10-192-2/+4
| | | | | | | | | | | | | | Summary: LLVM codebase has generated files (all are build/Target/XXX/*.inc) that exceed the MaxLine & MaxColumn. Printing these log would be noisy. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53400 llvm-svn: 344777
* [clangd] Fix msan failure after r344735 by initializing bitfieldsKrasimir Georgiev2018-10-191-0/+1
| | | | | | | | | That revision changed integer members to bitfields; the integers were default initialized before and the bitfields lost that default initialization. This started causing msan use-of-uninitialized memory in clangd tests. llvm-svn: 344773
* [clangd] Clear the semantic of RefSlab::size.Haojian Wu2018-10-185-12/+19
| | | | | | | | | | | | | | | | | Summary: The RefSlab::size can easily cause confusions, it returns the number of different symbols, rahter than the number of all references. - add numRefs() method and cache it, since calculating it everytime is nontrivial. - clear misused places. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53389 llvm-svn: 344745
* [clangd] Names that are not spelled in source code are reserved.Eric Liu2018-10-182-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Summary: These are often not expected to be used directly e.g. ``` TEST_F(Fixture, X) { ^ // "Fixture_X_Test" expanded in the macro should be down ranked. } ``` Only doing this for sema for now, as such symbols are mostly coming from sema e.g. gtest macros expanded in the main file. We could also add a similar field for the index symbol. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53374 llvm-svn: 344736
* [clangd] Encode Line/Column as a 32-bits integer.Haojian Wu2018-10-185-16/+80
| | | | | | | | | | | | | | | | | | | | | | Summary: This would buy us more memory. Using a 32-bits integer is enough for most human-readable source code (up to 4M lines and 4K columns). Previsouly, we used 8 bytes for a position, now 4 bytes, it would save us 8 bytes for each Ref and each Symbol instance. For LLVM-project binary index file, we save ~13% memory. | Before | After | | 412MB | 355MB | Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D53363 llvm-svn: 344735
OpenPOWER on IntegriCloud