summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Penalize file-scope symbols in the ranking for non-completion queriesSam McCall2019-02-011-4/+17
| | | | | | | | Patch by Nathan Ridge! Differential Revision: https://reviews.llvm.org/D56653 llvm-svn: 352868
* [clangd] Implement textDocument/declaration from LSP 3.14Sam McCall2019-02-016-109/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: LSP now reflects the declaration/definition distinction. Language server changes: - textDocument/definition now returns a definition if one is found, otherwise the declaration. It no longer returns declaration + definition if they are distinct. - textDocument/declaration returns the best declaration we can find. - For macros, the active macro definition is returned for both methods. - For include directive, the top of the target file is returned for both. There doesn't appear to be a discovery mechanism (we can't return everything to clients that only know about definition), so this changes existing behavior. In practice, it should greatly reduce the fraction of the time we need to show the user a menu of options. C++ API changes: - findDefinitions is replaced by locateSymbolAt, which returns a vector<LocatedSymbol> - one for each symbol under the cursor. - this contains the preferred declaration, the definition (if found), and the symbol name This API enables some potentially-neat extensions, like swapping between decl and def, and exposing the symbol name to the UI in the case of multiple symbols. Reviewers: hokein Subscribers: ilya-biryukov, javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D57388 llvm-svn: 352864
* [clangd] Use delimited style to make life easier for the fuzzerSam McCall2019-02-011-1/+1
| | | | llvm-svn: 352863
* [clangd] Unbreak fuzzer targetSam McCall2019-02-011-1/+3
| | | | llvm-svn: 352857
* [clangd] clangDaemonTweaks - fix -DBUILD_SHARED_LIBS=ON buildRoman Lebedev2019-02-011-0/+9
| | | | | | Followup for rL352841. llvm-svn: 352843
* [clangd] Fix -DBUILD_SHARED_LIBS=ON build - SwapIfBranches needs clangAST.Roman Lebedev2019-02-011-0/+1
| | | | | | | | | | | | | | | Else, fails with: [1/2] Linking CXX executable bin/clangd FAILED: bin/clangd : && /usr/bin/g++ -pipe -O2 -g0 -UNDEBUG -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -pipe -O2 -g0 -UNDEBUG -fuse-ld=lld -Wl,--color-diagnostics -Wl,-allow-shlib-undefined -Wl,-O3 -Wl,--gc-sections tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/SwapIfBranches.cpp.o tools/clang/tools/extra/clangd/tool/CMakeFiles/clangd.dir/ClangdMain.cpp.o -o bin/clangd -Wl,-rpath,"\$ORIGIN/../lib" lib/libLLVMSupport.so.9svn -lpthread lib/libclangBasic.so.9svn lib/libclangTidy.so.9svn lib/libclangDaemon.so.9svn lib/libclangFormat.so.9svn lib/libclangFrontend.so.9svn lib/libclangSema.so.9svn lib/libclangTooling.so.9svn lib/libclangToolingCore.so.9svn && : ld.lld: error: undefined symbol: clang::FunctionDecl::getBody(clang::FunctionDecl const*&) const >>> referenced by SwapIfBranches.cpp >>> tools/clang/tools/extra/clangd/refactor/tweaks/CMakeFiles/obj.clangDaemonTweaks.dir/SwapIfBranches.cpp.o:(clang::FunctionDecl::getBody() const) and so on. llvm-svn: 352841
* [clangd] Fix crash in applyTweak, remove TweakID alias.Sam McCall2019-02-015-19/+15
| | | | | | | Strings are complicated, giving them opaque names makes us forget they're complicated. llvm-svn: 352837
* [clangd] A code action to swap branches of an if statementIlya Biryukov2019-01-315-13/+240
| | | | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: llvm-commits, mgorny, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D56611 llvm-svn: 352796
* [clangd] Append "(fix available)" to diagnostic message when fixes are present.Eric Liu2019-01-311-0/+2
| | | | | | | | | | | | | | | | Summary: This would make diagnostic fixits more discoverable, especially for plugins like YCM. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D57509 llvm-svn: 352764
* [clangd] Drop fixes if replying with tweaks resulted in an errorIlya Biryukov2019-01-301-8/+2
| | | | | | | | | | This should not happen in normal operation, as it implies that the diagnostics with some available fixes were produced but the AST is invalid. Moreover, the code had an error: always returned code actions ignoring the SupportsCodeAction capability and writing a test for this is impossible, since this can only happen due to programmer's error rather than invalid inputs. llvm-svn: 352624
* [clangd] Fix a use after moveIlya Biryukov2019-01-301-2/+2
| | | | | | Introduced in r352494. llvm-svn: 352612
* [clangd] Remove extra ';' to fix -Wpedantic warning. NFCIlya Biryukov2019-01-291-1/+1
| | | | llvm-svn: 352511
* [clangd] Attempt to fix failing buildbots after r352494Ilya Biryukov2019-01-291-1/+1
| | | | | | | For failures see: http://lab.llvm.org:8011/builders/clang-x86_64-linux-abi-test/builds/38501/steps/build-unified-tree/logs/stdio llvm-svn: 352510
* [clangd] Make -clang-tidy-checks a non-hidden command-line argIlya Biryukov2019-01-291-2/+2
| | | | | | | | | | | | | | | | | | Summary: This looks like a useful user-facing configuration parameter, which should be discoverable. Also fix a small typo in the description. Reviewers: hokein Reviewed By: hokein Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D57384 llvm-svn: 352509
* [clangd] Interfaces for writing code tweaksIlya Biryukov2019-01-2913-16/+412
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The code tweaks are an implementation of mini-refactorings exposed via the LSP code actions. They run in two stages: - Stage 1. Decides whether the action is available to the user and collects all the information required to finish the action. Should be cheap, since this will run over all the actions known to clangd on each textDocument/codeAction request from the client. - Stage 2. Uses information from stage 1 to produce the actual edits that the code action should perform. This stage can be expensive and will only run if the user chooses to perform the specified action in the UI. One unfortunate consequence of this change is increased latency of processing the textDocument/codeAction requests, which now wait for an AST. However, we cannot avoid this with what we have available in the LSP today. Reviewers: kadircet, ioeric, hokein, sammccall Reviewed By: sammccall Subscribers: mgrang, mgorny, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D56267 llvm-svn: 352494
* [clangd] dlog clang-tidy configurationHaojian Wu2019-01-291-1/+1
| | | | | | vlog seems to be too spammy in unittests. llvm-svn: 352485
* [clangd] Make USRs for macros to be position independentKadir Cetinkaya2019-01-291-1/+2
| | | | | | | | | | | | | | Summary: USRs for macros were not cannonical due to usage of cursor location instead of definition location. Reviewers: jkorous Subscribers: ilya-biryukov, ioeric, MaskRay, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D57228 llvm-svn: 352481
* [clangd] Index main-file macros (bug 39761)Haojian Wu2019-01-281-3/+14
| | | | | | | | Patch by Nathan Ridge! Differential Revision: https://reviews.llvm.org/D55739 llvm-svn: 352367
* [clangd] Suggest adding missing includes for incomplete type diagnostics.Eric Liu2019-01-2816-72/+329
| | | | | | | | | | | | | | | | | | | Summary: This enables clangd to intercept compiler diagnostics and attach fixes (e.g. by querying index). This patch adds missing includes for incomplete types e.g. member access into class with only forward declaration. This would allow adding missing includes for user-typed symbol names that are missing declarations (e.g. typos) in the future. Reviewers: sammccall Reviewed By: sammccall Subscribers: mgorny, ilya-biryukov, javed.absar, MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D56903 llvm-svn: 352361
* [clangd] NFC: fix clang-tidy warnings.Haojian Wu2019-01-2510-31/+32
| | | | | | | Most are about llvm code style violation (found via readability-identifier-naming check). llvm-svn: 352205
* [clangd] Log clang-tidy configuration, NFCHaojian Wu2019-01-251-0/+2
| | | | | | | | | | | | Summary: This is used for debugging purpose. Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D57057 llvm-svn: 352184
* [clangd] Clean the cache of file statuses on vscode-clangd when clangd crashes.Haojian Wu2019-01-241-5/+17
| | | | | | | | | | | | | | Summary: Clear the cached file statuses, otherwise we will leave some garbage texts on the status bar when clangd crashes. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D56540 llvm-svn: 352049
* [CodeComplete] [clangd] Fix crash on ValueDecl with a null typeIlya Biryukov2019-01-241-1/+3
| | | | | | | | | | | | Reviewers: kadircet Reviewed By: kadircet Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D57093 llvm-svn: 352040
* [clangd] Fix crash due to ObjCPropertyDeclIlya Biryukov2019-01-231-4/+10
| | | | | | | | | | | | With ObjCPropertyDecl, ASTNode.OrigD can be a ObjCPropertyImplDecl which is not a NamedDecl, leading to a crash since the code incorrectly assumes ASTNode.OrigD will always be a NamedDecl. Change by dgoldman (David Goldman)! Differential Revision: https://reviews.llvm.org/D56916 llvm-svn: 351941
* [clangd] Followup fix of rL351818Haojian Wu2019-01-221-3/+5
| | | | | | | | | ClangTidyOptions::getDefaults is not free, it will initialize all clang-tidy modules to get check-specific options, and we don't use this information in CodeComplete, so using an empty one (constructed by default constructor) is sufficient. llvm-svn: 351826
* Fix "missing field 'ClangTidyOpts' initializer" warning. NFCI.Simon Pilgrim2019-01-221-2/+3
| | | | llvm-svn: 351818
* [clangd] NFC: reduce log noise from Diagnostics.Eric Liu2019-01-221-2/+2
| | | | | | | | | | Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D57042 llvm-svn: 351813
* [clangd] Fix the broken buildbot.Haojian Wu2019-01-221-0/+1
| | | | llvm-svn: 351812
* [clangd] Fix the `-Wtype-limits` warning, NFCHaojian Wu2019-01-221-1/+0
| | | | | | The assertion is always true, and triggers a compiler warning, so remove it. llvm-svn: 351809
* [clangd] NFC: Use buildCompilerInvocation in CodeCompleteKadir Cetinkaya2019-01-225-59/+46
| | | | | | | | | | | | Reviewers: ilya-biryukov, sammccall Reviewed By: sammccall Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D56860 llvm-svn: 351793
* [clangd] Support clang-tidy configuration in clangd.Haojian Wu2019-01-227-18/+51
| | | | | | | | | | | | | | | | | | | | | Summary: This patch adds some basic supports for clang-tidy configurations in clangd: - clangd will respect .clang-tidy configurations for each file - we don't aim to support all clang-tidy options in clangd, only a small subset of condfigurations (options related to which checks will be enabled) are supported. - add a `clang-tidy-checks` CLI option that can override options from .clang-tidy file Reviewers: ilya-biryukov, sammccall Reviewed By: sammccall Subscribers: javed.absar, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D55256 llvm-svn: 351792
* [clangd] Filter out plugin related flags and move all commandline ↵Kadir Cetinkaya2019-01-226-28/+49
| | | | | | | | | | | | | | | | | | | | manipulations into OverlayCDB. Summary: Some projects make use of clang plugins when building, but clangd is not aware of those plugins therefore can't work with the same compile command arguments. There were multiple places clangd performed commandline manipulations, this one also moves them all into OverlayCDB. Reviewers: ilya-biryukov Subscribers: klimek, sammccall, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D56841 llvm-svn: 351788
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1998-392/+294
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [clangd] Make background index less chattyIlya Biryukov2019-01-181-1/+1
| | | | | | | | | | | | | | | | Summary: It is producing too much input in non-verbose mode, i.e. a message per indexed file Reviewers: sammccall, kadircet Reviewed By: sammccall Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D56915 llvm-svn: 351563
* Fix build breakage from llvm r351317Pavel Labath2019-01-161-3/+1
| | | | | | | The two-argument version of llvm::sys::fs::make_absolute no longer returns an error code. llvm-svn: 351319
* [clangd] Fix XPC after rCTE351280Fangrui Song2019-01-161-3/+3
| | | | llvm-svn: 351306
* [clangd] XPC transport layerJan Korous2019-01-1617-7/+634
| | | | | | | | | | | | - New transport layer for macOS. - XPC Framework - Test client Framework and client were written by Alex Lorenz. Differential Revision: https://reviews.llvm.org/D54428 llvm-svn: 351280
* Update year in license filesHans Wennborg2019-01-151-1/+1
| | | | | | | In last year's update (D48219) it was suggested that the release manager might want to do this, so here we go. llvm-svn: 351194
* [clangd] Fix updated file detection logic in indexingKadir Cetinkaya2019-01-152-32/+38
| | | | | | | | | | | | | | | | | Summary: Files without any symbols were never marked as updated during indexing, which resulted in failure while writing shards for these files. This patch fixes the logic to mark files that are seen for the first time but don't contain any symbols as updated. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D56592 llvm-svn: 351170
* Revert r351051 "[clangd] Unlink VFS working dir from OS working dir."Amara Emerson2019-01-141-3/+2
| | | | | | The llvm commit r351050 broke some bots and was reverted. llvm-svn: 351100
* [clangd] Add Limit parameter for xref.Haojian Wu2019-01-149-31/+63
| | | | | | | | | | Reviewers: sammccall Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D56597 llvm-svn: 351081
* [clangd] Fix a reference invalidationKadir Cetinkaya2019-01-141-15/+19
| | | | | | | | | | Summary: Fix for the breakage in http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/52811/consoleFull#-42777206a1ca8a51-895e-46c6-af87-ce24fa4cd561 Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D56656 llvm-svn: 351052
* [clangd] Unlink VFS working dir from OS working dir.Sam McCall2019-01-141-2/+3
| | | | | | | | | | | | A lot of our previous FS manipulation was thread-unsafe in practice with the RealFS implementation. This switches to a different RealFS mode where path-manipulation is used to simulate multiple working dirs. r351050 both added this mode and removed the cache. If we want to move back to the old implementation we need to put the cache back. llvm-svn: 351051
* [clangd] Index main-file symbols (bug 39761)Sam McCall2019-01-143-24/+34
| | | | | | | | Patch by Nathan Ridge! Differential Revision: https://reviews.llvm.org/D55185 llvm-svn: 351041
* [clangd] Introduce loading of shards within auto-indexKadir Cetinkaya2019-01-102-67/+217
| | | | | | | | | | | | | | | | Summary: Whenever a change happens on a CDB, load shards associated with that CDB before issuing re-index actions. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55224 llvm-svn: 350847
* [clangd] Don't store completion info if the symbol is not used for code ↵Haojian Wu2019-01-102-10/+29
| | | | | | | | | | | | | | | | | | | | | completion. Summary: This would save us some memory and disk space: - Dex usage (261 MB vs 266 MB) - Disk (75 MB vs 76 MB) It would save more when we index the main file symbol D55185. Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: nridge, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D56314 llvm-svn: 350803
* [clangd] Fix a crash when reading an empty index file.Haojian Wu2019-01-081-3/+6
| | | | | | | | | | | | | | | Summary: Unfortunately, yaml::Input::setCurrentDocument() and yaml::Input::nextDocument() are internal APIs, the way we use them may cause a nullptr accessing when processing an empty YAML file. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D56442 llvm-svn: 350633
* [clangd] Fix Windows build after r350531Ilya Biryukov2019-01-071-1/+1
| | | | llvm-svn: 350542
* [clangd] Include <cstdio> instead of <stdio.h>. NFCIlya Biryukov2019-01-071-1/+1
| | | | | | This fixes the only clang-tidy check currently enabled by clangd. llvm-svn: 350540
* [clangd] Remove 'using namespace llvm' from .cpp files. NFCIlya Biryukov2019-01-0747-1398/+1479
| | | | | | | | The new guideline is to qualify with 'llvm::' explicitly both in '.h' and '.cpp' files. This simplifies moving the code between header and source files and is easier to keep consistent. llvm-svn: 350531
OpenPOWER on IntegriCloud