summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra
Commit message (Collapse)AuthorAgeFilesLines
...
* [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
* Make add_new_check.py's insertion of registerCheck<> match the sort orderDaniel Sanders2019-08-301-20/+39
| | | | | | | | | | | | | | | | | Summary: Following on from review comments in D65919 about the ordering of the registerCheck<> calls. Sort based on the check name which might be on the line after the registerCheck<> Reviewers: aaron.ballman Subscribers: cfe-commits, llvm-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66505 llvm-svn: 370527
* [clang-tidy] Add llvm-prefer-register-over-unsigned to clang-tidyDaniel Sanders2019-08-3010-0/+340
| | | | | | | | | | | | | | | | | Summary: This clang-tidy check is looking for unsigned integer variables whose initializer starts with an implicit cast from llvm::Register and changes the type of the variable to llvm::Register (dropping the llvm:: where possible). Reviewers: arsenm, bogner Subscribers: jholewinski, MatzeB, qcolombet, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, wdng, nhaehnle, mgorny, sbc100, jgravelle-google, kristof.beyls, hiraditya, aheejin, kbarton, fedor.sergeev, javed.absar, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, tpr, PkmX, jocewei, jsji, Petar.Avramovic, asbirlea, Jim, s.egerton, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D65919 llvm-svn: 370512
* [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-302-2/+4
| | | | | | | | | | 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-299-45/+54
| | | | | | | | | | 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
* [clang-tidy] Fix the potential infinite loop in ↵Haojian Wu2019-08-282-0/+11
| | | | | | | | | | | | | | | | | | recordIsTriviallyDefaultConstructible. Summary: The recordIsTriviallyDefaultConstructible may cause an infinite loop when running on an ill-formed decl. Reviewers: gribozavr Subscribers: nemanjai, xazax.hun, kbarton, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66874 llvm-svn: 370200
* [clang-tidy] readability-identifier-naming shouldn't complain about CRTP ↵Sam McCall2019-08-283-0/+40
| | | | | | | | | | | | | | pseudo-overrides Reviewers: ilya-biryukov Subscribers: xazax.hun, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66864 llvm-svn: 370193
* [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
* [clang-doc] Use llvm::createStringError and canonicalize error messagesFangrui Song2019-08-287-109/+99
| | | | | | | | | | | | | "Bad block found.\n" -> "bad block found" The lower cased form with no full stop or newline is more common in LLVM tools. Reviewed By: juliehockett Differential Revision: https://reviews.llvm.org/D66783 llvm-svn: 370155
* [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
* Remove clang-tidy-vs from clang-tools-extra (PR41791)Alex Lorenz2019-08-2739-3507/+8
| | | | | | | | | | | | | | | | | | | | | | The clang-tidy-vs visual studio plugin in clang-tools-extra contains a security vulnerability in the YamlDotNet package [1]. I posted to cfe-dev [2], asking if there was anyone who was interested in updating the the plugin to address the vulnerability. Reid mentioned that Zach (the original committer), said that there's another plugin (Clang Power Tools) that provides clang-tidy support, with additional extra features, so it would be ok to remove clang-tidy-vs. This commit removes the plugin to address the security vulnerability, and adds a section to the release notes that mentions that the plugin was removed, and suggests to use Clang Power Tools. Fixes PR 41791. [1]: https://nvd.nist.gov/vuln/detail/CVE-2018-1000210 [2]: http://lists.llvm.org/pipermail/cfe-dev/2019-August/063196.html Differential Revision: https://reviews.llvm.org/D66813 llvm-svn: 370096
* Use FileEntryRef for PPCallbacks::HasIncludeAlex Lorenz2019-08-272-2/+2
| | | | | | | | This fixes the issue where a filename dependendency was missing if the file that was referenced with __has_include() was accessed through a symlink in an earlier run, if the file manager was reused between runs. llvm-svn: 370081
* Refactor GlobList from an ad-hoc linked list to a vectorDmitri Gribenko2019-08-272-20/+31
| | | | | | | | | | | | Summary: I think it makes method implementations more obvious. Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66788 llvm-svn: 370039
* [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
* [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
* GlobList: added a clear test for pattern priorityDmitri Gribenko2019-08-271-1/+35
| | | | | | | | | | | | | | Summary: The last glob that matches the string decides whether that string is included or excluded. Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66787 llvm-svn: 370028
* Revert "[clangd] Release notes" (wrong branch)Sam McCall2019-08-271-92/+1
| | | | | | This reverts commit 51029e5c153bd33efa015e2ec35b60247d046ce4. llvm-svn: 370022
* Fix clangd's IndexAction for FileSkipped API updateAlex Lorenz2019-08-271-2/+2
| | | | llvm-svn: 370004
* Use FileEntryRef for PPCallbacks::FileSkippedAlex Lorenz2019-08-273-4/+6
| | | | | | | | 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] Release notesSam McCall2019-08-261-1/+92
| | | | llvm-svn: 369934
* [clang-doc] Switch Generator::CreateResources to use llvm::ErrorJulie Hockett2019-08-264-28/+44
| | | | | | Differential Revision: https://reviews.llvm.org/D66502 llvm-svn: 369925
* [clangd] Fix docsKadir Cetinkaya2019-08-261-2/+3
| | | | llvm-svn: 369920
* Moved GlobList into a separate header fileDmitri Gribenko2019-08-2610-125/+173
| | | | | | | | | | | | | | Summary: It is a separate abstraction that is used in more contexts than just a helper for ClangTidyDiagnosticConsumer. Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66747 llvm-svn: 369918
* [clangd] Add docs for configuration knobs in clangdKadir Cetinkaya2019-08-262-0/+40
| | | | | | | | | | | | | | | | Summary: This is a first step in documenting different configuration knobs we have in clangd. Reviewers: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66740 llvm-svn: 369917
OpenPOWER on IntegriCloud