summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd
Commit message (Collapse)AuthorAgeFilesLines
...
* [clangd] Support multifile edits as output of TweaksKadir Cetinkaya2019-09-0915-68/+271
| | | | | | | | | | | | | | | | | | | | Summary: First patch for propogating multifile changes from tweak outputs to LSP WorkspaceEdits. Uses SM to convert tooling::Replacements to TextEdits. Errors out if there are any inconsistencies between the draft version and the version generated the edits. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66637 llvm-svn: 371392
* [clangd] Update clangd-vscode docs to be more user-focused.Sam McCall2019-09-099-56/+131
| | | | | | | | | | | | | | Summary: Relegate "updating the extension" docs to a separate file. Reviewers: hokein, kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67092 llvm-svn: 371390
* [clangd] Highlight typedefs to template parameters as template parametersIlya Biryukov2019-09-092-6/+25
| | | | | | | | | | | | | | | | | | | | | | | Summary: Template parameters were handled outside `addType`, this led to lack of highlightings for typedefs to template types. This was never desirable, we want to highlight our typedefs as their underlying type. Note that typedefs to more complicated types, like pointers and references are still not highlighted. Original patch by Johan Vikström. Reviewers: hokein, jvikstrom Reviewed By: hokein Subscribers: nridge, javed.absar, kristof.beyls, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66516 llvm-svn: 371379
* [clangd] Replace HighlightingKind::NumKinds with LastKind. NFCIlya Biryukov2019-09-093-6/+3
| | | | | | | | | | | | | | | | | | Summary: The latter simplifies the client code by avoiding the need to handle it as a separate case statement. Reviewers: hokein Reviewed By: hokein Subscribers: nridge, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67277 llvm-svn: 371375
* [clangd] Improve output of semantic highlighting tests in case of failuresIlya Biryukov2019-09-093-2/+76
| | | | | | | | | | | | | | | | | | | | | Summary: Instead of matching lists of highlightings, we annotate input code with resulting highlightings and diff it against the expected annotated input. In case of failures, this produces much nicer output in form of text-based diffs. Reviewers: hokein Reviewed By: hokein Subscribers: nridge, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67274 llvm-svn: 371373
* [clang][Index][NFC] Put IndexingOptions to a separate headerJan Korous2019-09-064-0/+4
| | | | llvm-svn: 371250
* [clangd] Use override keyword to override the base class method, NFCHaojian Wu2019-09-061-3/+2
| | | | llvm-svn: 371194
* [clangd] Initialize int field to zero. NFCIlya Biryukov2019-09-051-1/+1
| | | | | | To make sure we do not have uninitialized values and undefined behavior. llvm-svn: 371081
* [clangd][vscode] Add a flag to enable semantic highlighting in clangdHaojian Wu2019-09-052-4/+11
| | | | | | | | | | | | Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67096 llvm-svn: 371038
* [clangd][vscode] Make SemanticHighlightingFeature more self-contained.Haojian Wu2019-09-052-7/+16
| | | | | | | | | | | | | | | | | Summary: so that we don't have too many usage from the client side (just a single occurrance for register), this also aligns with how other builtin feature being implemented in vscode. Reviewers: ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67165 llvm-svn: 371036
* [clangd] Add TUScheduler.h to CodeComplete.cpp to unbreak buildsKadir Cetinkaya2019-09-041-0/+1
| | | | llvm-svn: 370895
* [clangd] Fix SelectionTree behavior on implicit 'this'Sam McCall2019-09-042-0/+15
| | | | llvm-svn: 370884
* [clangd] Remove macro-expansion-location from getBeginningOfIdentifier. ↵Sam McCall2019-09-044-20/+26
| | | | | | Inline into relevant callsites. NFC llvm-svn: 370869
* [clangd] Remove obsolete includes. NFCSam McCall2019-09-043-4/+2
| | | | llvm-svn: 370865
* [clangd] Move threading helper to more appropriate header. NFCSam McCall2019-09-043-15/+15
| | | | llvm-svn: 370864
* [clangd] Rename ClangdUnit.h -> ParsedAST.h. NFCSam McCall2019-09-0431-44/+65
| | | | | | | | | | This much better reflects what is (now) in this header. Maybe a rename to ParsedTU would be an improvement, but that's a much more invasive change and life is too short. ClangdUnit is dead, long live ClangdUnitTests! llvm-svn: 370862
* [clangd] Split Preamble.h out of ClangdUnit.h. NFCSam McCall2019-09-0412-236/+297
| | | | | | | | | | | | | | Summary: Add comment describing use of preamble in clangd. Remove deps on ClangdUnit.h where possible. Subscribers: mgorny, ilya-biryukov, javed.absar, MaskRay, jkorous, mgrang, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D67117 llvm-svn: 370843
* [clangd] Move getBeginningOfIdentifier from ClangdUnit to SourceCode. Drop ↵Sam McCall2019-09-0315-99/+105
| | | | | | dependencies on ClangdUnit from some headers. NFC llvm-svn: 370768
* [clangd] Remove redundant semi-colon.Michael Liao2019-09-031-1/+1
| | | | llvm-svn: 370763
* [clangd] Decouple macro/decl-under-cursor finding. Don't pretend there can ↵Sam McCall2019-09-031-73/+41
| | | | | | be multiple macros. NFC. llvm-svn: 370759
* [clangd] Fix a data race in test codeIlya Biryukov2019-09-031-1/+3
| | | | | | Found by TSan, thanks bkramer for pointing this out. llvm-svn: 370758
* [clangd] Wrong attribute on debug function in r370746Sam McCall2019-09-031-1/+1
| | | | llvm-svn: 370757
* Fix MSVC "not all control paths return a value" warning. NFCI.Simon Pilgrim2019-09-031-0/+1
| | | | llvm-svn: 370750
* [clangd] Add targetDecl(), which determines what declaration an AST node ↵Sam McCall2019-09-036-1/+996
| | | | | | | | | | | | | | | | | | | | | | | | | | | | refers to. Summary: This is the first part of an effort to "unbundle" our libIndex use into separate concerns (AST traversal, token<->node mapping, node<->decl mapping, decl<->decl relationshipes). Currently, clangd relies on libIndex to associate tokens, AST nodes, and decls. This leads to rather convoluted implementations of e.g. hover and extract-function, which are not naturally thought of as indexing applications. The idea is that by decoupling different concerns, we make them easier to use, test, and combine, and more efficient when only one part is needed. There are some synergies between e.g. traversal and finding relationships between decls, hopefully the benefits outweight these. Reviewers: kadircet, ilya-biryukov Subscribers: mgorny, MaskRay, jkorous, arphaman, jfb, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66751 llvm-svn: 370746
* [clangd] Add highlighting for macro expansions.Johan Vikstrom2019-08-304-29/+42
| | | | | | | | | | | | | | Summary: https://github.com/clangd/clangd/issues/134 Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66995 llvm-svn: 370482
* [clangd] Added highlighting for structured bindings.Johan Vikstrom2019-08-302-0/+19
| | | | | | | | | | | | | | Summary: Structured bindings are in a BindingDecl. The decl the declRefExpr points to are the BindingDecls. So this adds an additional if statement in the addToken function to highlight them. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66738 llvm-svn: 370473
* [Clangd] ExtractFunction Added checks for broken control flowShaurya Gupta2019-08-302-17/+75
| | | | | | | | | | | | | | | | Summary: - Added checks for broken control flow - Added unittests Reviewers: sammccall, kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66732 llvm-svn: 370455
* [clangd] Collecting main file macro expansion locations in ParsedAST.Johan Vikstrom2019-08-303-1/+94
| | | | | | | | | | | | | | Summary: TokenBuffer does not collect macro expansions inside macro arguments which is needed for semantic higlighting. Therefore collects macro expansions in the main file in a PPCallback when building the ParsedAST instead. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66928 llvm-svn: 370452
* [Tooling] Migrated APIs that take ownership of objects to unique_ptrDmitri Gribenko2019-08-301-1/+1
| | | | | | | | | | Subscribers: jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66960 llvm-svn: 370451
* [clangd] Add .vscode-test to .gitignore.Haojian Wu2019-08-301-0/+1
| | | | | | | | | | | | Reviewers: jvikstrom Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66949 llvm-svn: 370446
* [clangd] Add distinct highlightings for static fields and methodsNathan Ridge2019-08-304-14/+33
| | | | | | | | | | | | | | Reviewers: hokein, ilya-biryukov, jvikstrom Reviewed By: hokein Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66828 llvm-svn: 370429
* Changed FrontendActionFactory::create to return a std::unique_ptrDmitri Gribenko2019-08-292-30/+30
| | | | | | | | | | Subscribers: jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66947 llvm-svn: 370379
* [Clangd] NFC: Added fixme for checking for local/anonymous types for ↵Shaurya Gupta2019-08-291-0/+1
| | | | | | extracted parameters llvm-svn: 370372
* [clangd] Update out-of-date links in readme, NFC.Haojian Wu2019-08-291-3/+3
| | | | llvm-svn: 370371
* [clangd][NFC] Update background-index command line descriptionKadir Cetinkaya2019-08-291-2/+1
| | | | | | | | | | | | | | | | Summary: We didn't change this in D64019 just in case we revert it back. Deleting it now. Reviewers: hokein, sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66943 llvm-svn: 370367
* Fix MSVC "not all control paths return a value" warning. NFCI.Simon Pilgrim2019-08-291-0/+1
| | | | llvm-svn: 370343
* [Index] Added a ShouldSkipFunctionBody callback to libIndex, and refactored ↵Dmitri Gribenko2019-08-291-30/+9
| | | | | | | | | | | | clients to use it instead of inventing their own solution Subscribers: jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66879 llvm-svn: 370338
* [Index] Stopped wrapping FrontendActions in libIndex and its usersDmitri Gribenko2019-08-292-54/+44
| | | | | | | | | Exposed a new function, createIndexingASTConsumer, that creates an ASTConsumer. ASTConsumers compose well. Removed wrapping functionality from createIndexingAction. llvm-svn: 370337
* [clangd] Update themeRuleMatcher when color theme changes in vscode extension.Johan Vikstrom2019-08-291-0/+7
| | | | | | | | | | | | | | | | | Summary: Add event listener that listens to configuration changes and reloads the ThemeRuleMatcher when the theme changes. Right now it will not recolor the files, depends on the colorizer CL for that. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66406 llvm-svn: 370305
* Reland "[clangd] Migrate last tweak tests to TweakTesting.h and remove old ↵Sam McCall2019-08-291-134/+33
| | | | | | | | | helpers. NFC" This reverts commit 3dcf55aa45bad800533b36b70a14ebeb2b84e219, and avoids use of multiline raw strings in macro calls. llvm-svn: 370304
* [clangd] Fix ExtractFunction dependenciesHeejin Ahn2019-08-283-0/+3
| | | | | | | | | | | | | | Summary: Without these dependencies, builds with `-DBUILD_SHARED_LIBS=ON` fail. Reviewers: SureYeaah Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66910 llvm-svn: 370273
* Revert "[clangd] Migrate last tweak tests to TweakTesting.h and remove old ↵Sam McCall2019-08-281-31/+130
| | | | | | | | | helpers. NFC" This reverts commit 8f85685b5cf57eddea11fa444503ade220c724e4, which breaks on old gcc that have the macro + raw strings bug. llvm-svn: 370262
* [Clangd] Initial version of ExtractFunctionShaurya Gupta2019-08-283-0/+712
| | | | | | | | | | | | | | | | | | | Summary: - Only works for extraction from free functions - Basic analysis of the code being extracted. - Extract to void function - Bail out if extracting a return, continue or break. - Doesn't hoist decls yet Reviewers: kadircet, sammccall Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65526 llvm-svn: 370249
* [clangd] Migrate last tweak tests to TweakTesting.h and remove old helpers. NFCSam McCall2019-08-281-129/+30
| | | | llvm-svn: 370229
* [clangd][vscode] Don't leak the resourcesHaojian Wu2019-08-281-2/+5
| | | | | | | | | | | | | | Summary: We miss a few places where we need to add them to the subscriptions. Reviewers: jvikstrom Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66881 llvm-svn: 370218
* [clangd] Cleans up the semantic highlighting resources if clangd stops.Johan Vikstrom2019-08-283-34/+47
| | | | | | | | | | | | | | Summary: Disposes of the vscode listeners when clangd crashes and reuses the old highlighter when it restarts. The reason for reusing the highlighter is because this way the highlightings will not disappear as we won't have to dispose of them. Reviewers: hokein, ilya-biryukov Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66743 llvm-svn: 370202
* [clangd] Fix SelectionTree to allow selection range expression in foreach loops.Sam McCall2019-08-282-0/+26
| | | | | | | | | | | | Reviewers: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66869 llvm-svn: 370191
* [clangd] Surface errors from command-line parsingIlya Biryukov2019-08-2815-48/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Those errors are exposed at the first character of a file, for a lack of a better place. Previously, all errors were stored inside the AST and report accordingly. However, errors in command-line argument parsing could result in failure to produce the AST, so we need an alternative ways to report those errors. We take the following approach in this patch: - buildCompilerInvocation() now requires an explicit DiagnosticConsumer. - TUScheduler and TestTU now collect the diagnostics produced when parsing command line arguments. If pasing of the AST failed, diagnostics are reported via a new ParsingCallbacks::onFailedAST method. If parsing of the AST succeeded, any errors produced during command-line parsing are stored alongside the AST inside the ParsedAST instance and reported as previously by calling the ParsingCallbacks::onMainAST method; - The client code that uses ClangdServer's DiagnosticConsumer does not need to change, it will receive new diagnostics in the onDiagnosticsReady() callback Errors produced when parsing command-line arguments are collected using the same StoreDiags class that is used to collect all other errors. They are recognized by their location being invalid. IIUC, the location is invalid as there is no source manager at this point, it is created at a later stage. Although technically we might also get diagnostics that mention the command-line arguments FileID with after the source manager was created (and they have valid source locations), we choose to not handle those and they are dropped as not coming from the main file. AFAICT, those diagnostics should always be notes, therefore it's safe to drop them without loosing too much information. Reviewers: kadircet Reviewed By: kadircet Subscribers: nridge, javed.absar, MaskRay, jkorous, arphaman, cfe-commits, gribozavr Tags: #clang Differential Revision: https://reviews.llvm.org/D66759 llvm-svn: 370177
* [clangd] Add a distinct highlighting for local variablesNathan Ridge2019-08-274-68/+76
| | | | | | | | | | | | | | | | | | Summary: It's useful to be able to distinguish local variables from namespace scope variables. Reviewers: hokein, jvikstrom Reviewed By: hokein Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66723 llvm-svn: 370103
* [Driver] Add an option for createInvocationFromCommandLine to recover on errorsIlya Biryukov2019-08-272-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, it would always return nullptr on any error. This change adds a parameter, controlling whether the function should attempt to return a non-null result even if unknown arguments (or other errors were encountered). The new behavior is only used in clangd. Considered an alternative of changing the return value instead of adding a new parameter, but that would require updating all callsites. Settled with the parameter to minimize the code changes. Reviewers: gribozavr Reviewed By: gribozavr Subscribers: nridge, jkorous, arphaman, kadircet, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66731 llvm-svn: 370033
OpenPOWER on IntegriCloud