summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd
Commit message (Collapse)AuthorAgeFilesLines
...
* [clang-tools-extra] [cmake] Link against libclang-cpp whenever possibleMichal Gorny2019-10-046-13/+31
| | | | | | | | | Use clang_target_link_libraries() in order to support linking against libclang-cpp instead of static libraries. Differential Revision: https://reviews.llvm.org/D68448 llvm-svn: 373786
* [clangd] update the package-lock.json.Haojian Wu2019-10-041-364/+380
| | | | llvm-svn: 373739
* [CodeComplete] Ensure object is the same in compareOverloads()Ilya Biryukov2019-10-041-0/+19
| | | | | | | | | | | | | | | | | | Summary: This fixes a regression that led to size() not being available in clangd when completing 'deque().^' and using libc++. Reviewers: sammccall Reviewed By: sammccall Subscribers: jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68335 llvm-svn: 373710
* [Clangd] ExtractFunction: Don't extract body of enclosing function.Shaurya Gupta2019-10-022-8/+28
| | | | | | | | | | | | | | | | | | | Summary: This patch disable extraction of the body of the enclosing function. `void f() [[{}]]` Extracting this CompoundStmt would leave the enclosing function without a body. Reviewers: sammccall, kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68245 llvm-svn: 373472
* [Clangd] Ensure children are always RootStmt in ExtractFunction (Fixes #153)Shaurya Gupta2019-10-022-4/+17
| | | | | | | | | | | | | | | | | | Summary: We weren't always checking if children are RootStmts in ExtractFunction. For `void f([[int a]]);`, the ParmVarDecl appeared as a RootStmt since we didn't perform the check and ended up being casted to a (null) Stmt. Reviewers: sammccall, kadircet Subscribers: kristof.beyls, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68182 llvm-svn: 373471
* [clangd] Bail out early if we are sure that the symbol is used outside of ↵Haojian Wu2019-10-022-19/+31
| | | | | | | | | | | | | | | | | | the file. Summary: This would reduce the false positive when the static index is in an unavailable state, e.g. background index is not finished. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68325 llvm-svn: 373444
* [clangd] SelectionTree should mark a node as fully-selected if the only ↵Sam McCall2019-10-024-27/+30
| | | | | | | | | | | | | | | | | | | claimed tokens were early-claimed. Summary: Previously they would be marked as partially-selected based on the early claim, and never updated as no more tokens were claimed. This affects simple VarDecls like "int x". Reviewers: SureYeaah Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66872 llvm-svn: 373442
* [clangd] Always send file URIs to editorsKadir Cetinkaya2019-10-021-1/+1
| | | | | | | | | | | | | | | | Summary: Editors only know about file URIs, make sure we do not use any custom schemes while sending edits. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68324 llvm-svn: 373435
* [clangd] Implement getBeginning for overloaded operators.Haojian Wu2019-10-014-20/+113
| | | | | | | | | | | | | | | | Summary: This will fix some bugs where navigation doesn't work on cases like `std::cout <^< "hello"`. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67695 llvm-svn: 373323
* [clangd] Use the index-based API to do the header-source switch.Haojian Wu2019-10-016-9/+69
| | | | | | | | | | | | | | | | Summary: If the file heuristic fails, we try to use the index&AST to do the header/source inference. Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68211 llvm-svn: 373320
* [clangd] Handle template arguments in findExplicitReferencesIlya Biryukov2019-10-012-2/+68
| | | | | | | | | | | | | | Reviewers: kadircet Reviewed By: kadircet Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68137 llvm-svn: 373318
* [clangd] Handle OverloadExpr in targetDeclIlya Biryukov2019-10-012-0/+30
| | | | | | | | | | | | | | Reviewers: sammccall Reviewed By: sammccall Subscribers: nridge, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68119 llvm-svn: 373305
* [clangd] Implement a smart version of HeaderSource switch.Haojian Wu2019-09-303-0/+264
| | | | | | | | | | | | | | | | | | | Summary: This patch implements another version header-source switch by incorporating the AST and index, it will be used: - to improve the current header-source switch feature (layer with the existing file heuristic); - by the incoming define-outline code action; Reviewers: kadircet Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67907 llvm-svn: 373197
* [clangd] Fix template type aliases in findExplicitReferenceIlya Biryukov2019-09-272-21/+28
| | | | | | | | | | | | | | Reviewers: kadircet Reviewed By: kadircet Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68124 llvm-svn: 373104
* clang-tidy: Don't repeat list of all checks in three places.Nico Weber2019-09-272-48/+6
| | | | | | | | | | | | Instead, put all checks in a cmake variable and reference this. Also, make clangd use the the ClangTidyForceLinker.h header instead of duplicating the list of modules -- the duplicate copy was missing the new "darwin" checker added in r373065. Differential Revision: https://reviews.llvm.org/D68132 llvm-svn: 373082
* [clangd] Remove an unrelated comment, NFC.Haojian Wu2019-09-271-1/+0
| | | | llvm-svn: 373079
* [clangd] Handle type template parameters in findExplicitReferencesIlya Biryukov2019-09-272-0/+25
| | | | | | | | | | | | | | Reviewers: kadircet Reviewed By: kadircet Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68120 llvm-svn: 373067
* [clang-tidy] New check to warn when storing dispatch_once_t in non-static, ↵Dmitri Gribenko2019-09-271-0/+1
| | | | | | | | | | | | | | | | | | | | | non-global storage. Summary: Creates a new darwin ClangTidy module and adds the darwin-dispatch-once-nonstatic check that warns about dispatch_once_t variables not in static or global storage. This catches a missing static for local variables in e.g. singleton initialization behavior, and also warns on storing dispatch_once_t values in Objective-C instance variables. C/C++ struct/class instances may potentially live in static/global storage, and are ignored for this check. The osx.API static analysis checker can find the non-static storage use of dispatch_once_t; I thought it useful to also catch this issue in clang-tidy when possible. This is a re-land of https://reviews.llvm.org/D67567 Reviewers: thakis, gribozavr, stephanemoore Subscribers: Eugene.Zelenko, mgorny, xazax.hun, jkorous, arphaman, kadircet, usaxena95 Tags: #clang-tools-extra, #clang, #llvm Differential Revision: https://reviews.llvm.org/D68109 llvm-svn: 373065
* [clangd] Support OverloadExpr in findExplicitReferencesIlya Biryukov2019-09-272-1/+43
| | | | | | | | | | | | | | Reviewers: kadircet Reviewed By: kadircet Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68118 llvm-svn: 373057
* Revert "[clang-tidy] New check to warn when storing dispatch_once_t in ↵Dmitri Gribenko2019-09-261-1/+0
| | | | | | | | non-static, non-global storage" This reverts commit r373028, because the new test fails on Linux. llvm-svn: 373032
* [clang-tidy] New check to warn when storing dispatch_once_t in non-static, ↵Stephane Moore2019-09-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | non-global storage Summary: Creates a new darwin ClangTidy module and adds the darwin-dispatch-once-nonstatic check that warns about dispatch_once_t variables not in static or global storage. This catches a missing static for local variables in e.g. singleton initialization behavior, and also warns on storing dispatch_once_t values in Objective-C instance variables. C/C++ struct/class instances may potentially live in static/global storage, and are ignored for this check. The osx.API static analysis checker can find the non-static storage use of dispatch_once_t; I thought it useful to also catch this issue in clang-tidy when possible. Contributed By: mwyman Reviewers: benhamilton, hokein, stephanemoore, aaron.ballman, gribozavr Reviewed By: stephanemoore, gribozavr Subscribers: jkorous, arphaman, kadircet, usaxena95, NoQ, xazax.hun, lebedev.ri, mgorny, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D67567 llvm-svn: 373028
* [clangd] Bump vscode-clangd v0.0.18Haojian Wu2019-09-261-1/+1
| | | | | | | | CHANGELOG: - enable semantic highlighting by default - upgrade the LSP dependencies to pickup the incoming LSP v3.15.0 llvm-svn: 372981
* [clangd][vscode] Add npm helper commands to package/release the extension.Haojian Wu2019-09-262-3/+5
| | | | | | | | | | | | | | Summary: Help to fix https://github.com/clangd/clangd/issues/159. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68080 llvm-svn: 372980
* Return results by value from ClangTidyCheckFactories::createChecksDmitri Gribenko2019-09-261-1/+1
| | | | llvm-svn: 372979
* [clangd][vscode] Update vscode lsp dependencies to pickup the new changes in ↵Haojian Wu2019-09-261-3/+3
| | | | | | | | | | | | | | | | LSP v3.15.0. Summary: This would enable the newly-added semantic selection feature in vscode. Reviewers: usaxena95 Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67964 llvm-svn: 372970
* [clangd][vscode] Turn on the semantic highlighting by default.Haojian Wu2019-09-261-1/+1
| | | | | | | | | | | | | | | | Summary: We have turned on the flag manually and used it for a while, and don't see any major issues, let's enable it by default. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68077 llvm-svn: 372969
* [clangd] Add a helper for extracting nonlocal decls in a FunctionDeclKadir Cetinkaya2019-09-263-1/+103
| | | | | | | | | | | | | | | | | | | Summary: To be used by define-inline code action to determine whether the function/method body will still be valid in another context. Traverses clang-ast to find all decl nodes under the function decl and stores the non-local ones. Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67748 llvm-svn: 372948
* [clangd] Change constness of parameters to findExplicitRefsKadir Cetinkaya2019-09-252-6/+6
| | | | | | | | | | | | | | | | | | Summary: Recursive AST requires non-const ast nodes, but it doesn't really mutate them. In addition to that, in clangd we mostly have const ast nodes. So it makes sense to move the const_cast into callee rather than having it at every caller in the future. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68027 llvm-svn: 372888
* [clangd] Fix parseNamespaceEvents to parse the last tokenKadir Cetinkaya2019-09-252-0/+13
| | | | | | | | | | | | Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68020 llvm-svn: 372875
* [clangd] Add missing header guard, NFC.Haojian Wu2019-09-252-0/+10
| | | | llvm-svn: 372860
* [clangd] A helper to find explicit references and their namesIlya Biryukov2019-09-253-1/+549
| | | | | | | | | | | | | | | | | | | | | | Summary: Allows to simplify pending code tweaks: - the upcoming DefineInline tweak (D66647) - remove using declaration (D56612) - qualify name under cursor (D56610) Another potential future application is simplifying semantic highlighting. Reviewers: kadircet Reviewed By: kadircet Subscribers: mgrang, jfb, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67826 llvm-svn: 372859
* [clangd] Move the existing heder-source-switch implemenation out of ↵Haojian Wu2019-09-257-130/+170
| | | | | | | | | | | | | | | | | | clangdServer. Summary: This is a NFC change. Reviewers: kadircet Reviewed By: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67960 llvm-svn: 372841
* [clangd] Add semantic selection to ClangdLSPServer.Utkarsh Saxena2019-09-246-0/+123
| | | | | | | | | | | | | | | | | | | | | | Summary: This adds semantic selection to the LSP Server. Adds support for serialization of input request and the output reply. Also adds regression tests for the feature. Currently we do not support multi cursor.The LSP Server only accepts single position in the request as opposed to many position in the spec. Spec: https://github.com/microsoft/language-server-protocol/blob/dbaeumer/3.15/specification.md#textDocument_selectionRange Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67720 llvm-svn: 372753
* [clangd] Save an unnecessary copy, NFC.Haojian Wu2019-09-241-1/+1
| | | | llvm-svn: 372752
* [clangd] Collect macros in the preamble region of the main fileHaojian Wu2019-09-249-113/+126
| | | | | | | | | | | | | | | | Summary: - store all macro references in the ParsedAST; - unify the two variants of CollectMainFileMacros; Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67496 llvm-svn: 372725
* [clangd] Simplify the callside of URI::resolve, NFC.Haojian Wu2019-09-237-38/+27
| | | | | | | | | | | | | | | | Summary: - Add a overrloded URI::resolve, which accepts a string URI; - also fixed some callside that don't check the error; Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67916 llvm-svn: 372617
* [clangd] Fix another TSAN issueBenjamin Kramer2019-09-171-1/+3
| | | | llvm-svn: 372128
* Add SemanticRanges to Clangd server.Utkarsh Saxena2019-09-175-2/+66
| | | | | | | | | | | | | | | | | | | | | | | Summary: Adds Semantic Ranges capabilities to Clangd server. Also adds tests for running it via clangd server. This differs from the LSP spec as the spec needs this to be evaluated on multiple 'pos' and the expected output is an list of list of semantic ranges. This is majorly for multi cursor and assuming this is a rare thing, we don't want to optimize make things complicated just for this. This should be done in the LSP level by queueing one request per 'pos' in the input. LSP Spec: https://github.com/microsoft/language-server-protocol/blob/dbaeumer/3.15/specification.md#textDocument_selectionRange Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67650 llvm-svn: 372102
* [clangd] Remove stale comment. NFCIlya Biryukov2019-09-171-2/+0
| | | | llvm-svn: 372074
* [clangd] Simplify semantic highlighting visitorIlya Biryukov2019-09-161-169/+111
| | | | | | | | | | | | | | | | | | | | | | | | Summary: - Functions to compute highlighting kinds for things are separated from the ones that add highlighting tokens. This keeps each of them more focused on what they're doing: getting locations and figuring out the kind of the entity, correspondingly. - Less special cases in visitor for various nodes. This change is an NFC. Reviewers: hokein Reviewed By: hokein Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67341 llvm-svn: 372008
* [clangd][vscode] update the development doc.Haojian Wu2019-09-161-2/+2
| | | | llvm-svn: 371986
* [clangd] Bump vscode-clangd v0.0.17Haojian Wu2019-09-161-1/+1
| | | | | | | | | | | CHANGELOG: - added semantic highlighting support (under the clangd.semanticHighlighting flag); - better error message when clangd fails to execute refactoring-like actions; - improved the readme doc; llvm-svn: 371980
* Implement semantic selections.Utkarsh Saxena2019-09-165-0/+241
| | | | | | | | | | | | | | Summary: For a given cursor position, it returns ranges that are interesting to the user. Currently the semantic ranges correspond to the nodes of the syntax trees. Subscribers: mgorny, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67358 llvm-svn: 371976
* [clangd] Fix a crash when renaming operator.Haojian Wu2019-09-162-0/+11
| | | | | | | | | | | | | | | | | | | | Summary: The renamelib uses a tricky way to calculate the end location by relying on decl name, this is incorrect for the overloaded operator (the name is "operator++" instead of "++"), which will cause out-of-file offset. We also disable renaming operator symbol, this case is tricky, and renamelib doesnt handle it properly. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67607 llvm-svn: 371971
* [Support] Add overload writeFileAtomically(std::function Writer)Jan Korous2019-09-131-31/+7
| | | | | | Differential Revision: https://reviews.llvm.org/D67424 llvm-svn: 371890
* [clangd] Collect location of macro definition in the ParsedASTHaojian Wu2019-09-105-42/+52
| | | | | | | | | | | | allows semantic hightlighting macro definition Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67264 llvm-svn: 371504
* [clangd] some tweaks on the vscode readme, NFCHaojian Wu2019-09-101-3/+3
| | | | llvm-svn: 371495
* [clangd] Attempt to fix failing Windows buildbots.Ilya Biryukov2019-09-091-3/+6
| | | | | | | | | The assertion is failing on Windows, probably because path separator is different. For the failure see: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/28072/steps/test/logs/stdio llvm-svn: 371422
* [clangd] Use pre-populated mappings for standard symbolsIlya Biryukov2019-09-097-76/+84
| | | | | | | | | | | | | | | | | | | | Summary: This takes ~5% of time when running clangd unit tests. To achieve this, move mapping of system includes out of CanonicalIncludes and into a separate class Reviewers: sammccall, hokein Reviewed By: sammccall Subscribers: MaskRay, jkorous, arphaman, kadircet, jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67172 llvm-svn: 371408
* [clangd] Add a new highlighting kind for typedefsIlya Biryukov2019-09-094-18/+48
| | | | | | | | | | | | | | | | | | | Summary: We still attempt to highlight them as underlying types, but fallback to the generic 'typedef' highlighting kind if the underlying type is too complicated. Reviewers: hokein Reviewed By: hokein Subscribers: nridge, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67290 llvm-svn: 371402
OpenPOWER on IntegriCloud