summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Fix for r370029 test that got left in my clientSam McCall2019-08-271-1/+1
| | | | llvm-svn: 370030
* [clangd] Fix toHalfOpenFileRange where start/end endpoints are in different ↵Sam McCall2019-08-274-32/+143
| | | | | | | | | | | | | | | | files due to #include Summary: https://github.com/clangd/clangd/issues/129 Reviewers: SureYeaah Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66590 llvm-svn: 370029
* Fix clangd's IndexAction for FileSkipped API updateAlex Lorenz2019-08-271-2/+2
| | | | llvm-svn: 370004
* Use FileEntryRef for PPCallbacks::FileSkippedAlex Lorenz2019-08-271-1/+3
| | | | | | | | This fixes the issue where a filename dependendency was missing if the file that was skipped was included through a symlink in an earlier run, if the file manager was reused between runs. llvm-svn: 369998
* [clangd] Handling text editor/document lifetimes in vscode extension.Johan Vikstrom2019-08-262-11/+36
| | | | | | | | | | | | | | | | Summary: Just reapplies highlightings for all files when visible text editors change. Could find the correct text editor that should be reapplied but going for a simple implementation instead. Removes the associated highlighting entry from the Colorizer when a text document is closed. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66735 llvm-svn: 369911
* [clangd] Added a colorizer to the vscode extension.Johan Vikstrom2019-08-263-9/+230
| | | | | | | | | | | | | | | | | | | | Summary: Adds the main colorizer component. It colorizes every time clangd sends a publishSemanticHighlighting notification. Every time it colorizes it does a full recolorization (removes all decorations from the editor and applies new ones). The reason for this is that all ranges for the same scope share a TextEditorDecorationType. This is due to TextEditorDecorationTypes being very expensive to create. The prototype used one DecorationType per range but that ran into very big performance problems (it took >100 ms to apply 600 lines of highlightings which froze the editor). This version does not share the problem of being extremly slow, but there is probably potential to optimize it even more. No document/texteditor lifecycle management code in this CL, that will come in the next one. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66219 llvm-svn: 369893
* [clangd] Send highlighting diff beyond the end of the file.Haojian Wu2019-08-268-45/+57
| | | | | | | | | | | | | | Summary: This would make the client life (tracking the changes) easier. Reviewers: jvikstrom Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66541 llvm-svn: 369884
* [clangd] Link more clang-tidy modules to clangdHaojian Wu2019-08-232-5/+10
| | | | | | | | | | | | | | Summary: There are two new clang-tidy modules being added recently. Reviewers: sammccall, jdoerfert Subscribers: srhines, mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66632 llvm-svn: 369741
* Fight a bit against global initializers. NFC.Benjamin Kramer2019-08-222-658/+658
| | | | llvm-svn: 369695
* [clangd] Fold string copy into lambda capture. NFC.Benjamin Kramer2019-08-221-3/+2
| | | | llvm-svn: 369679
* [Clangd] Tweaktesting replace toString with consumeErrorShaurya Gupta2019-08-221-1/+1
| | | | llvm-svn: 369676
* Fixed Missing Expected error handlingShaurya Gupta2019-08-221-1/+3
| | | | llvm-svn: 369666
* [clangd] Send suppported codeActionKinds to the client.Haojian Wu2019-08-221-1/+11
| | | | | | | | | | | | | | | | | | | Summary: This would make client know which codeActionKinds that clangd may return. VSCode will add a new entry "Refactor..." (which shows all refactoring-kind code actions) in the right-click menu. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66592 llvm-svn: 369656
* Remove \brief commands from doxygen comments.Dmitri Gribenko2019-08-225-8/+8
| | | | | | | | | | | | | | | | | | | | | | | Summary: We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done [This is analogous to LLVM r331272 and CFE r331834] Subscribers: srhines, nemanjai, javed.absar, kbarton, MaskRay, jkorous, arphaman, jfb, kadircet, jsji, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66578 llvm-svn: 369643
* [clangd] The ClangdServer::EnableHiddenFeatures is not used any more.Haojian Wu2019-08-221-1/+0
| | | | | | Remove it. llvm-svn: 369631
* [clangd] Ignore implicit conversion-operator nodes in find refs.Haojian Wu2019-08-212-0/+17
| | | | | | | | | | | | Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66478 llvm-svn: 369514
* [clangd] Fix one testcase in XRefsTests.Haojian Wu2019-08-202-20/+30
| | | | | | | | | | | | | | | | | | Summary: The test didn't test anything actually -- it used "[]" as annotation which should be "[[]]". This patch also fixes a bug in XRef where we may return duplicated refs. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66349 llvm-svn: 369387
* [clangd] Skip function bodies inside processed files while indexingIlya Biryukov2019-08-203-16/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This significantly improves performance of background indexing. We do not collect references and declarations inside the processed files, so this does not affect the final indexing results. The idea is borrowed from libclang, which has a similar optimization in its indexing functionality. Measurements show a nice decrease in indexing time, up to ~40% for building the whole index. These are not proper benchmarks, so one should not rely on these results too much. 1. Rebuilding the whole index for LLVM: - Before. Total time: 14m58s. ./bin/clangd -pch-storage=memory < ./clangd.input 23917.67s user 515.86s system 2718% cpu 14:58.68 total - After. Total time: 8m41s. ./bin/clangd -pch-storage=memory < ./clangd.input 13627.29s user 288.10s system 2672% cpu 8:40.67 total 2. Rebuilding index after removing shards matching '*clangd*' (case-insensitively): - Before. Total time: 30s. ./bin/clangd -pch-storage=memory < ./clangd.input 130.94s user 6.82s system 452% cpu 30.423 total - After. Total time: 26s. ./bin/clangd -pch-storage=memory < ./clangd.input 80.51s user 5.40s system 333% cpu 25.777 total Reviewers: kadircet, sammccall Reviewed By: kadircet Subscribers: MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66226 llvm-svn: 369349
* [clangd] Added highlighting for tokens that are macro arguments.Johan Vikstrom2019-08-192-8/+92
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Adds semantic highlighting for tokens that are a macro argument. Example: ``` D_V(SomeVar); ``` The "SomeVar" inside the macro is highlighted as a variable now. Tokens that are in a macro body expansion are ignored in this patch for three reasons. * The spelling loc is inside the macro "definition" meaning it would highlight inside the macro definition (could probably easily be fixed by using getExpansionLoc instead of getSpellingLoc?) * If wanting to highlight the macro definition this could create duplicate tokens. And if the tokens are of different types there would be conflicts (tokens in the same range but with different types). Say a macro defines some name and both a variable declaration and a function use this, there would be two tokens in the macro definition but one with Kind "Variable" and the other with Kind "Function". * Thirdly, macro body expansions could come from a file that is not the main file (easily fixed, just check that the Loc is in the main file and not even a problem if we wanted to highlight the actual macro "invocation") Reviewers: hokein, sammccall, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64741 llvm-svn: 369275
* [clangd] Added special HighlightingKind for function parameters.Johan Vikstrom2019-08-194-15/+31
| | | | | | | | | | | | | | Summary: This means that function parameters are no longer highlighted as variable.other.cpp but instead as variable.parameter.cpp which is the more "correct" TextMate scope for them. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66335 llvm-svn: 369238
* [clangd] suppress -Wparentheses warning: suggest parentheses around ‘&&’ ↵Haojian Wu2019-08-161-1/+1
| | | | | | within ‘||’ llvm-svn: 369105
* [clangd] Simplify code of ClangdLSPServer::onCommandIlya Biryukov2019-08-161-41/+33
| | | | | | | | | | | | | | | | | | | | Summary: By inlining a complicated lambda into its single call-site. Also ensure we call Reply() exactly once even if tweaks return both ShowMessage and ApplyEdit effects. Reviewers: hokein Reviewed By: hokein Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66343 llvm-svn: 369100
* [clangd] Added highlighting for non type templates.Johan Vikstrom2019-08-162-0/+57
| | | | | | | | | | | | | | | Summary: Non type templates were not being highlighted. This highlights them as TemplateParameters. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66221 llvm-svn: 369090
* [clangd] Remove Bind, use C++14 lambda captures instead. NFCIlya Biryukov2019-08-163-65/+15
| | | | llvm-svn: 369089
* [clangd] Don't use Bind() where C++14 move capture worksBenjamin Kramer2019-08-155-255/+212
| | | | llvm-svn: 369005
* [clangd] llvm::integer_sequence -> std::integer_sequence.Benjamin Kramer2019-08-151-1/+1
| | | | llvm-svn: 368991
* Replace llvm::integer_sequence and friends with the C++14 standard versionBenjamin Kramer2019-08-152-4/+4
| | | | | | The implementation in libc++ takes O(1) compile time, ours was O(n). llvm-svn: 368990
* [clang-tools-extra] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-1435-84/+84
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368944
* [clangd][vscode] Surface the error when applying tweaks failsHaojian Wu2019-08-141-2/+19
| | | | | | | | | | | | | | | | | | | Summary: The current behavior for a failed request is just to log it in the output panel. When applyTweak fails for whatever reason, users usually don't get informed (unless they open the output panel and dig the log). this patch is to surface these errors by prompting up a message diag. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66211 llvm-svn: 368851
* [clangd] Print qualifiers of out-of-line definitions in document outlineIlya Biryukov2019-08-142-35/+128
| | | | | | | | | | | | | | | | Summary: To improve the UX around navigating and searching through the results. Reviewers: hokein Reviewed By: hokein Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66215 llvm-svn: 368842
* [Clangd] NFC: Fixed comment typoShaurya Gupta2019-08-141-1/+1
| | | | llvm-svn: 368841
* [clangd] Loading TokenColorRules as a class mapping the rules to their ↵Johan Vikstrom2019-08-142-3/+67
| | | | | | | | | | | | | | | | associated clangd TextMate scope index. Summary: Loads a mapping of the clangd scope lookup table scopes to the most specific rule with the highest "precedence" on initialize. Preprocesses into a class so it's simple/fast to access when doing the actual coloring later. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65856 llvm-svn: 368834
* [clangd] Fix typos and grammar in a comment. NFCIlya Biryukov2019-08-141-4/+4
| | | | llvm-svn: 368824
* [clangd] Refactor computation of extracted expr in ExtractVariable tweak. NFCSam McCall2019-08-121-61/+66
| | | | | | | | | | | | | | | | | | | | | | | Summary: This takes this logic out of the Tweak class, and simplifies the signature of the function where the main logic is. The goal is to make it easier to turn into a loop like: for (current = N; current and current->parent are both expr; current = current->parent) if (suitable(current)) return current; return null; Reviewers: SureYeaah Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65333 llvm-svn: 368590
* [clangd] Separate chunks with a space when rendering markdownIlya Biryukov2019-08-122-4/+45
| | | | | | | | | | | | | | | | | | | | | Summary: This results in better rendering of resulting markdown. Especially noticeable in coc.nvim that does not have a visible horizontal spaces around inline code blocks. More details and a screenshot from coc.nvim can be found in https://github.com/clangd/clangd/issues/95. Reviewers: sammccall Reviewed By: sammccall Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66086 llvm-svn: 368581
* [clangd] Added the vscode SemanticHighlighting feature code but did not ↵Johan Vikstrom2019-08-123-5/+115
| | | | | | | | | | | | | | | | enable it in the client. Summary: Added the code for the StaticFeature that must be registered to the client. Also decoding the notification data into objects. Did not register it to the client yet. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65998 llvm-svn: 368568
* [clangd] Remove highlightings coming from non topLevelDecls from included files.Johan Vikstrom2019-08-122-2/+25
| | | | | | | | | | | | | | Summary: It is possible to write include code from other files so that the decls from there do not become topLevelDecls (For example by including methods for a class). These Decls are not filtered by topLevelDecls and therefore SemanticHighlighting must manually check that every SLoc belongs in the main file. Otherwise there can be highlightings appearing in places where they should not. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66083 llvm-svn: 368563
* [clangd] Drop diags from non-written #include.Haojian Wu2019-08-122-2/+15
| | | | | | | | | | | | | | Summary: This would fix that we show weird diagnostics on random lines of the main file. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66074 llvm-svn: 368549
* [clangd] Highlighting auto variables as the deduced type.Johan Vikstrom2019-08-122-16/+40
| | | | | | | | | | | | | | | | | | Summary: Done in VisitDeclaratorDecl as the AutoTypeLoc is not deduced. Scoped to only work for variables. auto function return values need to be handled in a special way (separate patch for that). auto's that are in lambdas ar enot highlighted as we don't highlight their underlying type (it's a RecordDecl, but the name is not an identifier so it returns in addToken). Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65996 llvm-svn: 368546
* [clangd] Disallow extraction of expression-statements.Sam McCall2019-08-095-54/+97
| | | | | | | | | | | | | | | | | | | | | Summary: I split out the "extract parent instead of this" logic from the "this isn't worth extracting" logic (now in eligibleForExtraction()), because I found it hard to reason about. While here, handle overloaded as well as builtin assignment operators. Also this uncovered a bug in getCallExpr() which I fixed. Reviewers: SureYeaah Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65337 llvm-svn: 368500
* clangd: use -j for background index poolSam McCall2019-08-093-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: clangd supports a -j option to limit the amount of threads to use for parsing TUs. However, when using -background-index (the default in later versions of clangd), the parallelism used by clangd defaults to the hardware_parallelisn, i.e. number of physical cores. On shared hardware environments, with large projects, this can significantly affect performance with no way to tune it down. This change makes the -j parameter apply equally to parsing and background index. It's not perfect, because the total number of threads is 2x the -j value, which may still be unexpected. But at least this change allows users to prevent clangd using all CPU cores. Reviewers: kadircet, sammccall Reviewed By: sammccall Subscribers: javed.absar, jfb, sammccall, ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66031 llvm-svn: 368498
* [clangd] Give absolute path to clang-tidy and include-fixer. HintPath should ↵Sam McCall2019-08-091-5/+6
| | | | | | always be absolute, some URI schemes care. llvm-svn: 368482
* [clangd] Added highlighting for constructor initializers.Johan Vikstrom2019-08-092-0/+26
| | | | | | | | | | | | | | Summary: Constructor initializers were not being highlighted. This adds highlighting for them by using TraverseConstructorInitializer. Uses the Traverse* because there is no visit for CXXCtorInitializer. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66001 llvm-svn: 368434
* [clangd] Use raw rename functions to implement the rename.Haojian Wu2019-08-092-62/+47
| | | | | | | | | | | | | | | | | | | | | | | Summary: The API provided by refactoring lib doesn't provide enough flexibility to get clangd's rename to behave as we expect. Instead, we replace it with the low-level rename functions, which give us more control. Bonus: - performance, previously we visit the TU to find all occurrences, now we just visit top-level decls from main file; - fix a bug where we wrongly filter out the main file replacement due to the different relative/absolute file path; Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, jfb, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65936 llvm-svn: 368429
* [clangd] Fixed printTemplateSpecializationArgs not printing partial variable ↵Johan Vikstrom2019-08-093-1/+14
| | | | | | | | | | | | | | | | | | specialization arguments. Summary: printTemplateSpecializationArgs was not printing partial variable specialization args. This adds an additional If clause where we check if it's a VariableTemplatePartialSpecializationDecl and returns the ArgumentLocs if that's the case. Also adds tests for printTemplateSpecializationArgs in ASTTests.cpp. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65926 llvm-svn: 368403
* [AST] No longer visiting CXXMethodDecl bodies created by compiler when ↵Johan Vikstrom2019-08-091-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | method was default created. Summary: Clang generates function bodies and puts them in the AST for default methods if it is defaulted outside the class definition. ` struct A { A &operator=(A &&O); }; A &A::operator=(A &&O) = default; ` This will generate a function body for the `A &A::operator=(A &&O)` and put it in the AST. This body should not be visited if implicit code is not visited as it is implicit. This was causing SemanticHighlighting in clangd to generate duplicate tokens and putting them in weird places. Reviewers: hokein, ilya-biryukov, gribozavr Subscribers: mgorny, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65938 llvm-svn: 368402
* [clangd] Added semantic highlighting support for primitives.Johan Vikstrom2019-08-085-37/+51
| | | | | | | | | | | | | | | | Summary: Adds a new HighlightingKind "Primitive". Adds a special case for TypeLocs that have an underlying TypePtr that is are builtin types, adding them as primitives. The primary reason for this change is because otherwise typedefs that typedef primitives `typedef int A` would not get highlighted (so in the example `A` would not get any highlightings.) Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65943 llvm-svn: 368291
* [clangd] Added an early return from VisitMemberExpr in SemanticHighlighting ↵Johan Vikstrom2019-08-082-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | if underlying MemberDecl is a CXXConversionDecl. Summary: Conversion operators contain invalid MemberLocs which caused SemanticHighlighting to emit a lot of error logs in large files as they can occur fairly often (for example converting StringRef to std string). As the only thing happening was a lot of error logs being emited there doesn't really seem to be any way to test this (no erroneous tokens are added). But emiting as many logs as were being emited is not wanted. This also adds a test to guard against regressions for highlightings disapearing from places where the conversion operators are used as their behaviour differ from the other CXXMethodDecls. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65928 llvm-svn: 368287
* [clangd] Don't include internal gtest header.Haojian Wu2019-08-081-1/+0
| | | | llvm-svn: 368283
* [clangd] Remove a function accidently being added in rL368261.Haojian Wu2019-08-081-20/+0
| | | | llvm-svn: 368282
OpenPOWER on IntegriCloud