Commit Graph

3814 Commits

Author SHA1 Message Date
Jonas Toth fc07c3d910 [clang-tidy] NFC reorder registering in CppCoreGuidelines module
llvm-svn: 343673
2018-10-03 10:37:19 +00:00
Stephen Kelly 2c4079c090 [clang-query] Add comment token handling
Summary:
It is possible to pass a file of commands to clang-query using the
command line option -f or --preload.  Make it possible to write comments
in such files.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: mgorny, cfe-commits

Differential Revision: https://reviews.llvm.org/D52752

llvm-svn: 343666
2018-10-03 08:21:54 +00:00
Stephen Kelly 42668a4d03 [clang-query] Add single-letter 'q' alias for 'quit'
Reviewers: aaron.ballman, pcc

Reviewed By: aaron.ballman

Subscribers: Szelethus, cfe-commits

Differential Revision: https://reviews.llvm.org/D52746

llvm-svn: 343664
2018-10-03 07:52:44 +00:00
Mikael Holmen 101d9eae23 Fix compilation warning by removing unused variable [NFC]
clang complained with

../tools/clang/tools/extra/clangd/FS.cpp:19:12: error: unused variable 'Err' [-Werror,-Wunused-variable]
  if (auto Err = FS.makeAbsolute(PathStore))
           ^
1 error generated.

llvm-svn: 343661
2018-10-03 05:41:14 +00:00
Eric Liu 16922d0718 [clangd] Temporarily disable VFS stats cache test for windows.
llvm-svn: 343637
2018-10-02 21:47:41 +00:00
Eric Liu 9a3af5a4f1 [clangd] Try to fix windows buildbot after r343576
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/20347/steps/test/logs/stdio

llvm-svn: 343623
2018-10-02 20:00:32 +00:00
Sam McCall a659d779f8 Reland r343589 "[clangd] Dex: add Corpus factory for iterators, rename, fold constant. NFC""
This reverts commit r343610.

llvm-svn: 343622
2018-10-02 19:59:23 +00:00
Reid Kleckner 2b5259afb3 Revert r343589 "[clangd] Dex: add Corpus factory for iterators, rename, fold constant. NFC"
Declaring a field with the same name as a type causes GCC to error out:

Dex.h:104:10: error: declaration of 'clang::clangd::dex::Corpus clang::clangd::dex::Dex::Corpus' [-fpermissive]
   Corpus Corpus;
          ^
Iterator.h:127:7: error: changes meaning of 'Corpus' from 'class clang::clangd::dex::Corpus' [-fpermissive]
 class Corpus {

llvm-svn: 343610
2018-10-02 17:31:43 +00:00
Haojian Wu 795f6ed51c [clangd] Don't make check-clangd as a dependency in check-clang-tools
Summary:
check-clang-tools will run check-clangd first, and then run the rest
tests. If clangd tests fails, check-clang-tools would be stopped.

This would block other clang-tools developers if clangd is broken.

Reviewers: sammccall

Subscribers: mgorny, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D52781

llvm-svn: 343608
2018-10-02 17:22:11 +00:00
Haojian Wu 1c6b6deb33 [clangd] Add a #include completion test that triggers an assertion.
Summary: Test for https://reviews.llvm.org/D52774.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D52775

llvm-svn: 343593
2018-10-02 14:46:08 +00:00
Sam McCall 51be55d0ec [clangd] Zap TODONEs
llvm-svn: 343590
2018-10-02 13:51:43 +00:00
Sam McCall a1e7385d5c [clangd] Dex: add Corpus factory for iterators, rename, fold constant. NFC
Summary:
- Corpus avoids having to pass size to the true iterator, and (soon) any
  iterator that might optimize down to true.
- Shorten names of factory functions now they're scoped to the Corpus.
  intersect() and unionOf() rather than createAnd() or createOr() as this
  seems to read better to me, and fits with other short names. Opinion wanted!
- DEFAULT_BOOST_SCORE --> 1. This is a multiplier, don't obfuscate identity.
- Simplify variadic templates in Iterator.h

Reviewers: ioeric

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D52711

llvm-svn: 343589
2018-10-02 13:44:26 +00:00
Sam McCall 7402836042 [clangd] Dex iterator printer shows query structure, not iterator state.
Summary:
This makes it suitable for logging (which immediately found a bug, to
be fixed in the next patch...)

Reviewers: ioeric

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D52715

llvm-svn: 343580
2018-10-02 11:51:36 +00:00
Alexander Kornienko c5016c0a27 [clang-tidy] Ignore singe bit bitfield -> bool conversion in readability-implicit-bool-conversion
llvm-svn: 343578
2018-10-02 11:38:41 +00:00
Eric Liu b1d7542dde [clangd] Cache FS stat() calls when building preamble.
Summary:
The file stats can be reused when preamble is reused (e.g. code
completion). It's safe to assume that cached status is not outdated as we
assume preamble files to remain unchanged.

On real file system, this made code completion ~20% faster on a measured file
(with big preamble). The preamble build time doesn't change much.

Reviewers: sammccall, ilya-biryukov

Reviewed By: sammccall

Subscribers: mgorny, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D52419

llvm-svn: 343576
2018-10-02 10:43:55 +00:00
Kadir Cetinkaya b15b8dce39 [clangd] Remove override result handling logic from clangd
Summary:
Since we plan to move handling of override suggestions to Sema with
D52225 this patch just makes sure clangd-side has no logic related to that
anymore and updates tests.

Reviewers: ioeric, ilya-biryukov

Reviewed By: ioeric

Subscribers: MaskRay, jkorous, arphaman, cfe-commits

Differential Revision: https://reviews.llvm.org/D52226

llvm-svn: 343567
2018-10-02 09:42:17 +00:00
Jonas Toth 240b8f39fe [clang-tidy] NFC use CHECK-NOTES in test for cppgoreguidelines-avoid-goto
Reviewers: alexfh, aaron.ballman, hokein

Reviewed By: alexfh

Subscribers: nemanjai, xazax.hun, kbarton, cfe-commits

Differential Revision: https://reviews.llvm.org/D52686

llvm-svn: 343565
2018-10-02 09:38:26 +00:00
Jonas Toth 46619229ac [clang-tidy] NFC use CHECK-NOTES in tests for cppcoreguidelines-owning-memory
Reviewers: alexfh, aaron.ballman, hokein

Reviewed By: alexfh

Subscribers: nemanjai, xazax.hun, kbarton, cfe-commits

Differential Revision: https://reviews.llvm.org/D52687

llvm-svn: 343564
2018-10-02 09:38:20 +00:00
Stephen Kelly 12ae3e678d Sort expected test output after previous commit
llvm-svn: 343538
2018-10-01 21:10:30 +00:00
Stephen Kelly c87e99f4a4 [clang-query] Test non-code-completion on single letter shortcuts
llvm-svn: 343536
2018-10-01 20:45:44 +00:00
Stephen Kelly 98a38f53e7 [clang-query] Add missing quit test
llvm-svn: 343535
2018-10-01 20:45:39 +00:00
Stephen Kelly 9af02f2028 [clang-query] Add missing 'l' command handling
The `let` command was added in commit 045c15ba (Add new 'let' command to
bind arbitrary values into constants., 2014-04-23).

The `let` command and the non-existant `l` command were documented in
commit 233092a0 (Add 'let' to the help message., 2015-02-27).

Implement the `l` command now for completeness.

llvm-svn: 343533
2018-10-01 20:34:21 +00:00
Stephen Kelly c6356eceaa [clang-query] Sort command options
llvm-svn: 343532
2018-10-01 20:34:15 +00:00
Stephen Kelly a3c4206e41 [clang-tidy] Build it even without static analyzer
Conditionally compile the parts of clang-tidy which depend on the static
analyzer.

Funnily enough, I made the patch to exclude this from the build in 2013,
and it was committed with the comment that the tool should not be fully
excluded, but only the parts of it which depend on the analyzer should
be excluded.

 http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20130617/081797.html

This commit implements that idea.

Reviewed By: aaron.ballman

Tags: #clang-tools-extra

Differential Revision: https://reviews.llvm.org/D52334

llvm-svn: 343528
2018-10-01 20:24:22 +00:00
Haojian Wu 3e0c1bdbe4 [clangd] exclude check-clangd from check-all, fix buildbot failure.
check-clangd is included via check-clang-tools, otherwise we will run two
instances of check-clangd in parallel when running 'check-all',
which may have race condition.

llvm-svn: 343526
2018-10-01 20:21:41 +00:00
Haojian Wu 2b7b8f4d55 [clangd] Add "check-clangd" target
Summary:
So we don't have to run "check-clang-tools" (which builds and tests all
clang tools) to verify our clangd-related change. It'd save waiting time for
clangd developers.

check-clangd (build ~1000 files, run ~340 tests) vs check-clang-tools (build
~3000 files, run ~1000 tests).

In the future, we probably want to add similar target for other
clang-tools (e.g. clang-tidy).

Reviewers: sammccall

Subscribers: mgorny, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D52710

llvm-svn: 343474
2018-10-01 14:02:02 +00:00
Sam McCall 329fc143fd [clangd] Query dex index using query-style trigrams, not identifier-style trigrams
llvm-svn: 343453
2018-10-01 10:42:51 +00:00
Eric Liu d5d6a60a78 [clangd] Fix header mapping for std::string. NFC
Some implementation has std::string declared in <iosfwd>.

llvm-svn: 343448
2018-10-01 08:50:49 +00:00
Aaron Ballman 873a50901b Reverting r343415 as it breaks at least one of the bots.
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/37336

llvm-svn: 343418
2018-09-30 17:39:39 +00:00
Aaron Ballman bc70c26ef4 Allow clang-tidy to be built without a dependency on the clang static analyzer.
Patch by Stephen Kelly.

llvm-svn: 343415
2018-09-30 17:22:58 +00:00
Vitaly Buka 0509070811 [cxx2a] Fix warning triggered by r343285
llvm-svn: 343369
2018-09-29 02:17:12 +00:00
Kirill Bobyrev f6439880a8 [docs] Fix links in Clangd documentation
Add missing `_` after each `external link <https://llvm.org>`_, as
required by the reStructuredText specification.

llvm-svn: 343306
2018-09-28 09:32:47 +00:00
Eric Liu 670c147d83 [clangd] Initial supoprt for cross-namespace global code completion.
Summary:
When no scope qualifier is specified, allow completing index symbols
from any scope and insert proper automatically. This is still experimental and
hidden behind a flag.

Things missing:
- Scope proximity based scoring.
- FuzzyFind supports weighted scopes.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: kbobyrev, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D52364

llvm-svn: 343248
2018-09-27 18:46:00 +00:00
Eric Liu ee7fe93fa8 [clangd] Add more tracing to index queries. NFC
Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D52611

llvm-svn: 343247
2018-09-27 18:23:23 +00:00
Kadir Cetinkaya 133d46f9a7 Introduce completionItemKind capability support.
Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, cfe-commits

Differential Revision: https://reviews.llvm.org/D52616

llvm-svn: 343237
2018-09-27 17:13:07 +00:00
Eric Liu fd9f426049 [clangd] Make IncludeInserter less slow. NFC
llvm-svn: 343223
2018-09-27 14:27:02 +00:00
Kadir Cetinkaya 0ed5d29b44 Tell whether file/folder for include completions.
Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, ioeric, jkorous, arphaman, cfe-commits

Differential Revision: https://reviews.llvm.org/D52547

llvm-svn: 343221
2018-09-27 14:21:07 +00:00
Jonas Toth 7829a938c5 [clang-tidy] use CHECK-NOTES in tests for bugprone suspicious-enum-usage
Reviewers: alexfh, aaron.ballman, hokein

Subscribers: xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D52229

llvm-svn: 343201
2018-09-27 12:30:44 +00:00
Jonas Toth 7dd69f15e1 [clang-tidy] use CHECK-NOTES in tests for bugprone-use-after-move
Reviewers: alexfh, aaron.ballman, hokein

Subscribers: xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D52228

llvm-svn: 343199
2018-09-27 12:22:48 +00:00
Jonas Toth 724a826288 [clang-tidy] use CHECK-NOTES in tests for bugprone-forward-declaration-namespace
Reviewers: aaron.ballman, alexfh, hokein

Subscribers: xazax.hun, cfe-commits

Differential Revision: https://reviews.llvm.org/D52185

llvm-svn: 343198
2018-09-27 12:17:59 +00:00
Kadir Cetinkaya 2e3f1f13b5 Improve diagnostics range reporting.
Summary:
If we have some range information coming from clang diagnostic, promote
that one even if it doesn't contain diagnostic location inside.

Reviewers: sammccall, ioeric

Reviewed By: ioeric

Subscribers: ilya-biryukov, jkorous, arphaman, cfe-commits

Differential Revision: https://reviews.llvm.org/D52544

llvm-svn: 343197
2018-09-27 12:12:42 +00:00
Fangrui Song b441be0924 [clang-tidy] Add dependency to clangAnalysis after rC343160
llvm-svn: 343168
2018-09-27 04:23:24 +00:00
Fangrui Song 8b9540379e llvm::sort(C.begin(), C.end()) -> llvm::sort(C)
The convenience wrapper in STLExtras is available since rL342102.

llvm-svn: 343166
2018-09-27 04:19:29 +00:00
Kirill Bobyrev ea4f20c6be [clangd] Fix bugs with incorrect memory estimate report
* With the current implementation, `sizeof(std::vector<Chunk>)` is added
twice to the `Dex` memory estimate which is incorrect
* `Dex` logs memory usage estimation before `BackingDataSize` is set and
hence the log report excludes size of the external `SymbolSlab` which is
coupled with `Dex` instance

Reviewed By: ioeric

Differential Revision: https://reviews.llvm.org/D52503

llvm-svn: 343117
2018-09-26 15:06:23 +00:00
Kirill Bobyrev 0cdf629394 [docs] Update PostingList string representation format
Because `PostingList` objects are compressed, it is now impossible to
see elements other than the current one and the documentation doesn't
match implementation anymore.

Reviewed By: ioeric

Differential Revision: https://reviews.llvm.org/D52545

llvm-svn: 343116
2018-09-26 14:59:49 +00:00
Simon Pilgrim 3462e76ba5 Removed extra semicolon to fix Wpedantic. (NFCI).
llvm-svn: 343083
2018-09-26 09:02:45 +00:00
Ilya Biryukov 652364b765 [clangd] Fix crash if pending computations were active on exit
Summary:
Make sure JSONRPCDispatcher outlives the worker threads, they access
its fields to remove the stored cancellations when Context dies.

Reviewers: sammccall, ioeric

Reviewed By: ioeric

Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits

Differential Revision: https://reviews.llvm.org/D52420

llvm-svn: 343067
2018-09-26 05:48:29 +00:00
Ilya Biryukov 4f98470dea [clangd] Handle template args for disabled function arg snippets
Reviewers: kadircet, ioeric, sammccall

Reviewed By: kadircet

Subscribers: MaskRay, jkorous, arphaman, cfe-commits

Differential Revision: https://reviews.llvm.org/D52422

llvm-svn: 343066
2018-09-26 05:45:31 +00:00
Fangrui Song cfac25c3bd [clangd] Remove unused using-declaration testing::AllOf
llvm-svn: 343039
2018-09-25 22:32:11 +00:00
Sam McCall 321d5d4802 [clangd] Extract mapper logic from clangd-indexer into a library.
Summary: Soon we can drop support for MR-via-YAML.
I need to modify some out-of-tree versions to use the library, first.

Reviewers: kadircet

Subscribers: mgorny, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

Differential Revision: https://reviews.llvm.org/D52465

llvm-svn: 343019
2018-09-25 20:02:36 +00:00