summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Use #if CLANGD_BUILD_XPC because it may be defined as 0Fangrui Song2019-04-101-1/+1
| | | | llvm-svn: 358094
* clangd: repair the build after SVN r358091Saleem Abdulrasool2019-04-101-1/+1
| | | | | | Fix the name of the variable being checked. NFCI. llvm-svn: 358093
* [clangd] Don't insert extra namespace qualifiers when Sema gets lost.Sam McCall2019-04-101-65/+72
| | | | | | | | | | | | | | | | | | | | | | | | Summary: There are cases where Sema can't tell that "foo" in foo::Bar is a namespace qualifier, like in incomplete macro expansions. After this patch, if sema reports no specifier but it looks like there's one in the source code, then we take it into account. Reworked structure and comments in getQueryScopes to try to fight creeping complexity - unsure if I succeeded. I made the test harder (the original version also passes). Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60503 llvm-svn: 358091
* [clangd] Add -header-insertion=never flag to disable include insertion in ↵Sam McCall2019-04-103-8/+33
| | | | | | | | | | | | | | | | code completion Summary: One clear use case: use with an editor that reacts poorly to edits above the cursor. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60409 llvm-svn: 358075
* [clangd] Refactor speculateCompletionFilter and also extract scope.Sam McCall2019-04-102-33/+40
| | | | | | | | | | | | | | | | | | | Summary: Intent is to use the heuristically-parsed scope in cases where we get bogus results from sema, such as in complex macro expansions. Added a motivating testcase we currently get wrong. Name changed because we (already) use this for things other than speculation. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60500 llvm-svn: 358074
* [clangd] Add fallback mode for code completion when compile command or ↵Eric Liu2019-04-085-16/+59
| | | | | | | | | | | | | | | | | | | | | | | | | preamble is not ready. Summary: When calling TUScehduler::runWithPreamble (e.g. in code compleiton), allow entering a fallback mode when compile command or preamble is not ready, instead of waiting. This allows clangd to perform naive code completion e.g. using identifiers in the current file or symbols in the index. This patch simply returns empty result for code completion in fallback mode. Identifier-based plus more advanced index-based completion will be added in followup patches. Reviewers: ilya-biryukov, sammccall Reviewed By: sammccall Subscribers: sammccall, javed.absar, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59811 llvm-svn: 357916
* Fix clangd-fuzzer buildNico Weber2019-04-042-2/+6
| | | | | | | | | r357102 made clangd-fuzzer no longer compile, but before r357654 / r357694 we didn't notice. Fix the compile. Also add a dep on FuzzMutate which I forgot to do in r357654. llvm-svn: 357696
* Use a cmake check for linux that actually works.Nico Weber2019-04-041-1/+1
| | | | llvm-svn: 357694
* [clangd] Stop passing around PCHContainerOperations, just create it in ↵Sam McCall2019-04-0411-66/+32
| | | | | | place. NFC llvm-svn: 357689
* Make clangd-fuzzer use the normal add_llvm_fuzzer() machineryNico Weber2019-04-044-9/+24
| | | | | | | | | This allows building it even if no fuzzer is enabled. (Sadly, it only builds on Linux at the moment.) Differential Revision: https://reviews.llvm.org/D60201 llvm-svn: 357654
* [clang-tidy] Remove the old ClangTidyCheck::registerPPCallbacks methodAlexander Kornienko2019-04-031-1/+0
| | | | | | | | | | | | | | | | | | Summary: All in-tree clang-tidy checks have been migrated to the new ClangTidyCheck::registerPPCallbacks method. Time to drop the old one. Reviewers: sammccall, hokein Reviewed By: hokein Subscribers: xazax.hun, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60197 llvm-svn: 357582
* gn build: Add build files for clangd xpc framework codeNico Weber2019-04-032-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a bit of a larger change since this is the first (and as far as I can tell only) place where the LLVM build produces macOS framework bundles. GN has some built-in support for this, so use that. `gn help create_bundle` has a terse description (but it's a bit outdated: `deps` must be `public_deps` and the conditionals in the example in the help aren't quite right on non-iOS). We need a new 'copy_bundle_data' tool, and since we copy the clangd.xpc bundle as bundle_data into ClangdXPC.framework it needs to be able to handle directories in addition to files. GN also insists we have a compile_xcassets tool even though it's not used. I just made that run `false`. Despite GN's support for bundles, we still need to manually create the expected symlink structure in the .framework bundle. Since this code never runs on Windows, it's safe to create the symlinks before the symlink targets exist, so we can just make the bundle depend on the steps that create the symlinks. For this to work, change the symlink script to create the symlink's containing directory if it doesn't yet exist. I locally verified that CMake and GN build create the same bundle structure. (I noticed that both builds set LC_ID_DYLIB to the pre-copy libClangdXPCLib.dylib name, but that seems to not cause any issues and it happens in the CMake build too.) (Also add an error message to clangd-xpc-test-client for when loading the dylib fails – this was useful while locally debugging this.) Differential Revision: https://reviews.llvm.org/D60130 llvm-svn: 357574
* [clangd] Return clangd::TextEdit in ClangdServer::rename. NFCIlya Biryukov2019-04-033-17/+12
| | | | | | | | | | | | | | | | | | | | Summary: Instead of tooling::Replacement. To avoid the need to have contents of the file at the caller site. This also aligns better with other methods in ClangdServer, majority of those already return LSP-specific data types. Reviewers: hokein, ioeric, sammccall Reviewed By: sammccall Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60179 llvm-svn: 357561
* [clangd] Use capacity() instead of size() in RefSlab::bytes()Ilya Biryukov2019-04-021-1/+1
| | | | | | | | | | | | | | | | Patch by Nathan Ridge. Reviewers: gribozavr Reviewed By: gribozavr Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D60040 llvm-svn: 357454
* Fix MSVC "not all control paths return a value" warning. NFCI.Simon Pilgrim2019-03-291-0/+1
| | | | llvm-svn: 357253
* gn build: Add check-clang-tools to run clang-tools-extra lit testsNico Weber2019-03-291-2/+2
| | | | | | | | | | | Only runs the clang-tools-extra lit tests; not yet the unit tests. Add a build file for clangd-indexer too, since it's needed for the tests. Differential Revision: https://reviews.llvm.org/D59955 llvm-svn: 357232
* Disable warnings when indexing as a standalone action.Sam McCall2019-03-281-0/+5
| | | | | | | | | | | | | | | | | | | Summary: - we don't record the warnings at all - we don't want to stop indexing if we hit error-limit due to warnings - this allows some analyses to be skipped which can save some CPU https://github.com/clangd/clangd/issues/24 Reviewers: hokein Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59935 llvm-svn: 357186
* gn build: Add some build files for clangdNico Weber2019-03-281-2/+2
| | | | | | | | | | | | | | Enough to build the clangd binaries, but this is still missing build files for: - fuzzer - indexer - index/dex/dexp - benchmarks - xpc Differential Revision: https://reviews.llvm.org/D59899 llvm-svn: 357182
* [clangd] Support UTF-32 (i.e. codepoint) offsets.Sam McCall2019-03-283-54/+84
| | | | | | | | | | | | | | | | Summary: (Changes to UTF-8/UTF-16 here are NFC, moving things around to make the cases more symmetrical) Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59927 llvm-svn: 357173
* [clangd] Support utf-8 offsets (rather than utf-16) as a protocol extensionSam McCall2019-03-279-21/+149
| | | | | | | | | | | | | | | | Summary: Still some pieces to go here: unit tests for new SourceCode functionality and a command-line flag to force utf-8 mode. But wanted to get early feedback. Reviewers: hokein Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58275 llvm-svn: 357102
* [clangd] Bump vscode-clangd v0.0.12.Haojian Wu2019-03-271-1/+1
| | | | | | | | | CHANGELOG: - add an explicit command to activate the extension. - support .cu files (the extension is not activated for .cu files by default, you need to manually activate the extension). llvm-svn: 357082
* [clangd] Fix the inconsistent code indent in vscode extension, NFC.Haojian Wu2019-03-271-21/+21
| | | | llvm-svn: 357078
* [clangd] Add activate command to the vscode extension.Haojian Wu2019-03-272-1/+10
| | | | | | | | | | | | | | | | Summary: This would help minizime the annoying part of not activating the extension for .cu file. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59817 llvm-svn: 357075
* Basic: Return a reference from FileManager::getVirtualFileSystem, NFCDuncan P. N. Exon Smith2019-03-261-1/+1
| | | | | | | | | | FileManager constructs a VFS in its constructor if it isn't passed one, and there's no way to reset it. Make that contract clear by returning a reference from its accessor. https://reviews.llvm.org/D59388 llvm-svn: 357038
* Frontend: Remove CompilerInstance::VirtualFileSystem, NFCDuncan P. N. Exon Smith2019-03-261-1/+1
| | | | | | | | | | | | | | | Remove CompilerInstance::VirtualFileSystem and CompilerInstance::setVirtualFileSystem, instead relying on the VFS in the FileManager. CompilerInstance and its clients already went to some trouble to make these match. Now they are guaranteed to match. As part of this, I added a VFS parameter (defaults to nullptr) to CompilerInstance::createFileManager, to avoid repeating construction logic in clients that just wanted to customize the VFS. https://reviews.llvm.org/D59377 llvm-svn: 357037
* [clangd] Add .cu files to VSCode extensionIlya Biryukov2019-03-251-1/+11
| | | | | | | | | | | | | | | | | | | | | | Summary: clangd should be able to handle those with a proper compilation database. However, users using 'nvcc' might start seeing spurious errors in '.cu' files after this change. My plan is to land and release this, but be ready to revert in case of negative user feedback. Reviewers: hokein Reviewed By: hokein Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59759 llvm-svn: 356916
* [clangd] Add std subnamespace symbols to the symbol map.Haojian Wu2019-03-252-34/+291
| | | | | | | | | | | | | | Reviewers: ioeric, serge-sans-paille Reviewed By: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59364 llvm-svn: 356894
* [clangd] Send empty diagnostics when a file is closedIlya Biryukov2019-03-252-7/+27
| | | | | | | | | | | | | | | | | | | | | | Summary: The LSP clients cannot know clangd will not send diagnostic updates for closed files, so we send them an empty list of diagnostics to avoid showing stale diagnostics for closed files in the UI, e.g. in the "Problems" pane of VSCode. Fixes PR41217. Reviewers: hokein Reviewed By: hokein Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59757 llvm-svn: 356880
* [clangd] Call the new ClangTidyCheck::registerPPCallbacks overloadAlexander Kornienko2019-03-221-0/+2
| | | | llvm-svn: 356788
* Revert "[clangd] Print arguments in template specializations"Jordan Rupprecht2019-03-203-32/+18
| | | | | | This reverts commit 44a63f6a150dec72dea43730d2a89d292e58bd6f. It segfaults on an internal test case (will follow up off thread). llvm-svn: 356623
* [clangd] Print arguments in template specializationsKadir Cetinkaya2019-03-203-18/+32
| | | | | | | | | | | | Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59354 llvm-svn: 356541
* [clangd] Add support for type hierarchy (super types only for now)Kadir Cetinkaya2019-03-1912-71/+368
| | | | | | | | | | | | | | | | | | | | | | | Summary: Patch by Nathan Ridge(@nridge)! This is an LSP extension proposed here: https://github.com/Microsoft/vscode-languageserver-node/pull/426 An example client implementation can be found here: https://github.com/theia-ide/theia/pull/3802 Reviewers: kadircet, sammccall Reviewed By: kadircet Subscribers: jdoerfert, sammccall, cfe-commits, mgorny, dschaefer, simark, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet Tags: #clang Differential Revision: https://reviews.llvm.org/D56370 llvm-svn: 356445
* [clangd] Tune the fuzzy-matching algorithmIlya Biryukov2019-03-151-11/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: To reduce the gap between prefix and initialism matches. The motivation is producing better scoring in one particular example, but the change does not seem to cause large regressions in other cases. The examples is matching 'up' against 'unique_ptr' and 'upper_bound'. Before the change, we had: - "[u]nique_[p]tr" with a score of 0.3, - "[up]per_bound" with a score of 1.0. A 3x difference meant that symbol quality signals were almost always ignored and 'upper_bound' was always ranked higher. However, intuitively, the match scores should be very close for the two. After the change we have the following scores: - "[u]nique_[p]tr" with a score of 0.75, - "[up]per_bound" with a score of 1.0. Reviewers: ioeric Reviewed By: ioeric Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59300 llvm-svn: 356261
* [clangd] Using symbol name to map includes for STL symbols.Haojian Wu2019-03-144-35/+1484
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Using suffix path mapping relies on the STL implementations, and it is not portable. This patch is using symbol name mapping, which should work with different STL implementations, fix clangd/clangd#9. To generate the symbol mapping, we parse the cppreference symbol index page to build a lookup table. The mapping is not completed, a few TODOs: - support symbols from different headers (e.g. std::move) - support STL macros - support symbols from std's sub-namespaces (e.g. chrono) Reviewers: ioeric, jfb, serge-sans-paille Reviewed By: ioeric Subscribers: sammccall, klimek, ilya-biryukov, ioeric, MaskRay, jkorous, mgrang, arphaman, kadircet, jfb, jdoerfert, cfe-commits Tags: #clang-tools-extra, #clang Differential Revision: https://reviews.llvm.org/D58345 llvm-svn: 356134
* [clangd] Fix an out-of-date FIXME, NFC.Haojian Wu2019-03-141-3/+0
| | | | llvm-svn: 356127
* [clangd] Build Dex index after loading all shards in BackgroundIndex.Haojian Wu2019-03-141-3/+7
| | | | | | | | | | | | | | | | Summary: Currently after loadding all shards, we use MemIndex which has poor query performance, we should use Dex. Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59350 llvm-svn: 356126
* [clangd] Store explicit template specializations in index for code ↵Kadir Cetinkaya2019-03-144-11/+33
| | | | | | | | | | | | | | | | | | | | | | | | | navigation purposes Summary: This introduces ~4k new symbols, and ~10k refs for LLVM. We need that information for providing better code navigation support: - When references for a class template is requested, we should return these specializations as well. - When children of a specialization is requested, we should be able to query for those symbols(instead of just class template) Number of symbols: 378574 -> 382784 Number of refs: 5098857 -> 5110689 Reviewers: hokein, gribozavr Reviewed By: gribozavr Subscribers: nridge, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59083 llvm-svn: 356125
* [clangd] Default initialize SymInfoKadir Cetinkaya2019-03-131-1/+1
| | | | llvm-svn: 356032
* [clangd] Respect Origin option in createStaticIndexingActionKadir Cetinkaya2019-03-112-2/+3
| | | | | | | | | | | | | | | | | | | Summary: Currently createStaticIndexingAction always set Origin to Static, which makes it hard to change it later on by different indexers(One needs to go over each symbol making a new copy). This patch changes that behavior to rather respect it if set by user. Reviewers: ioeric Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59205 llvm-svn: 355820
* [clangd] Remove ./ and ../ in the file pathsKadir Cetinkaya2019-03-081-0/+1
| | | | | | | | | | | | Reviewers: hokein Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59084 llvm-svn: 355681
* [clangd] Make sure constructors do not reference classKadir Cetinkaya2019-03-082-1/+10
| | | | | | | | | | | | Reviewers: gribozavr Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58815 llvm-svn: 355679
* [clangd] Deduplicate Refs on the fly.Haojian Wu2019-03-083-10/+11
| | | | | | | | | | | | | | | | | | | | Summary: Currently, we only do deduplication when we flush final results. We may have huge duplications (refs from headers) during the indexing period (running clangd-indexer on Chromium). With this change, clangd-indexer can index the whole chromium projects (48 threads, 40 GB peak memory usage). Reviewers: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, mgrang, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59092 llvm-svn: 355676
* [clangd] Adjust compile commands to be applicable for toolingKadir Cetinkaya2019-03-081-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: As can be seen in https://github.com/llvm-mirror/clang/blob/master/lib/Tooling/Tooling.cpp#L385 clang tool invocations adjust commands normally like this. In clangd we have different code paths for invoking a frontend action(preamble builds, ast builds, background index, clangd-indexer) they all work on the same GlobalCompilationDatabase abstraction, but later on are subject to different modifications. This patch makes sure all of the clangd actions make use of the same compile commands before invocation. Enables background-index to work on chromium codebase(since they had dependency file output in their compile commands). Reviewers: gribozavr, hokein Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59086 llvm-svn: 355669
* [clangd] Strip plugin arguments in clangd-indexer.Haojian Wu2019-03-071-1/+3
| | | | | | | | | | | | | | | | Summary: This would allow clangd-indexer runs on chromium repo. Reviewers: kadircet Reviewed By: kadircet Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59022 llvm-svn: 355599
* [clangd] Add Source to clangd::Diagnostic.Haojian Wu2019-03-063-1/+17
| | | | | | | | | | | | | | | Summary: clangd embedder can distinguish diagnostics from clang or clang-tidy. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58600 llvm-svn: 355493
* [clangd] Enable SuggestMissingIncludes by default.Eric Liu2019-03-011-1/+1
| | | | | | | | | | | | | | Summary: This seems to work stably now. Turn on by default. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58772 llvm-svn: 355200
* Fix file headers. NFCFangrui Song2019-03-013-3/+3
| | | | llvm-svn: 355188
* Added missing license headersDmitri Gribenko2019-02-284-1/+31
| | | | | | | | | | | | Reviewers: ioeric Subscribers: jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58781 llvm-svn: 355092
* Use ArrayRef::copy, instead of copying data manuallyDmitri Gribenko2019-02-281-3/+1
| | | | | | | | | | | | Reviewers: ioeric Subscribers: jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58782 llvm-svn: 355091
* Moved Ref into its own header and implementation fileDmitri Gribenko2019-02-2811-149/+192
| | | | | | | | | | | | Reviewers: ioeric Subscribers: mgorny, jkorous, mgrang, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58778 llvm-svn: 355090
OpenPOWER on IntegriCloud