Commit Graph

4392 Commits

Author SHA1 Message Date
Eric Liu e98b86cbe8 [clangd] Improve global code completion when scope specifier is unresolved.
Summary:
Suppose `clangd::` is unresolved in the following example. Currently,
we simply use "clangd::" as the query scope. We can do better by combining with
accessible scopes in the context. The query scopes can be `{clangd::, clang::clangd::}`.
```
namespace clang { clangd::^ }

```

Reviewers: ilya-biryukov, sammccall, hokein, kadircet

Reviewed By: kadircet

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

Tags: #clang

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

llvm-svn: 354963
2019-02-27 11:42:37 +00:00
Ilya Biryukov 8e19a65040 [clangd] Set thread priority on Windows
Reviewers: kadircet, gribozavr

Reviewed By: kadircet, gribozavr

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

Tags: #clang

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

llvm-svn: 354957
2019-02-27 10:16:03 +00:00
Jan Korous cba6eda155 [clangd] Library dependencies in XPC
Patch by Nicholas Allegra

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

llvm-svn: 354949
2019-02-27 02:37:44 +00:00
Jonas Toth c1e8cbd5c3 [clang-tidy] undo bitfields in ExceptionAnalyzer
Scoped enums do induce some problems with some MSVC and GCC versions
if used as bitfields. Therefor this is deactivated for now.

llvm-svn: 354903
2019-02-26 18:15:17 +00:00
Kadir Cetinkaya 60ec08f067 [clangd] Index UsingDecls
Summary:
D58340 enables indexing of USRs, this makes sure test in clangd are
aligned with the change

Reviewers: hokein

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

Tags: #clang

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

llvm-svn: 354879
2019-02-26 14:23:47 +00:00
Kadir Cetinkaya 8335fd1923 [clangd] Update docs to mention YCM integration and new LSP features
Reviewers: gribozavr

Reviewed By: gribozavr

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

Tags: #clang

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

llvm-svn: 354865
2019-02-26 11:08:04 +00:00
Haojian Wu da79dcc317 [clangd] Drop documentation in static index if symbols are not indexed for completion.
Summary:
This is a further optimization of r350803, we drop docs in static index for
symbols not being indexed for completion, while keeping the docs in dynamic
index (we rely on dynamic index to get docs for class members).

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

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

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

llvm-svn: 354792
2019-02-25 16:00:00 +00:00
Dmitri Gribenko a06e029081 Moved clangd docs to a separate directory in preparation to restructure them into multiple files
Reviewers: ilya-biryukov

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

Tags: #clang

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

llvm-svn: 354786
2019-02-25 13:43:48 +00:00
Clement Courbet 4bfa716f7c [clang-tidy] misc-string-integer-assignment: ignore toupper/tolower
Summary: Tis represents ~20% of false positives. See PR27723.

Reviewers: xazax.hun, alexfh

Subscribers: rnkovacs, cfe-commits

Tags: #clang

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

llvm-svn: 354780
2019-02-25 13:09:02 +00:00
Dmitri Gribenko cfa0d7a358 Updated the documentation build instructions for the current CMake build system
Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 354779
2019-02-25 13:03:44 +00:00
Dmitri Gribenko 52bb45f03f Fixed grammar in index.rst
Subscribers: arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 354778
2019-02-25 12:49:27 +00:00
Dmitri Gribenko a7aac27aaf Removed an unhelpful comment in index.rst
Reviewers: ilya-biryukov

Subscribers: arphaman, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 354777
2019-02-25 12:48:52 +00:00
Kadir Cetinkaya f47177ddb4 [clangd] Add thread priority lowering for MacOS as well
Reviewers: ilya-biryukov

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

Tags: #clang

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

llvm-svn: 354765
2019-02-25 09:19:26 +00:00
Marc-Andre Laperle 25e690273a [clangd] Enhance macro hover to see full definition
Summary: Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>

Reviewers: simark, ilya-biryukov, sammccall, ioeric, hokein

Reviewed By: ilya-biryukov

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

Tags: #clang

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

llvm-svn: 354761
2019-02-24 23:47:03 +00:00
Haojian Wu c8f7496257 [clangd] Don't attach FixIt to the source code in macro.
Summary:
We are less certain it is the correct fix. Also, clang doesn't apply FixIt to
the source code in macro.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

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

Tags: #clang

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

llvm-svn: 354664
2019-02-22 09:43:56 +00:00
Kadir Cetinkaya 748211a81f [clangd] Only report explicitly typed symbols during code navigation
Summary:
Clangd was reporting implicit symbols, like results of implicit cast
expressions during code navigation, which is not desired. For example:

```
struct Foo{ Foo(int); };
void bar(Foo);
vod foo() {
  int x;
  bar(^x);
}
```
Performing a GoTo on the point specified by ^ would give two results one
pointing to line `int x` and the other for definition of `Foo(int);`

Reviewers: ilya-biryukov, sammccall

Subscribers: ioeric, MaskRay, jkorous, mgrang, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 354585
2019-02-21 14:48:33 +00:00
Kadir Cetinkaya 84b584be62 [clangd] Enable indexing of template type parameters
Summary: Fixes https://bugs.llvm.org/show_bug.cgi?id=36285

Reviewers: ilya-biryukov

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

Tags: #clang

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

llvm-svn: 354561
2019-02-21 09:55:00 +00:00
Eric Liu 4971436b21 [clangd] Handle another incomplete-type diagnostic case in IncludeFixer.
llvm-svn: 354558
2019-02-21 09:33:49 +00:00
Douglas Yung 38dd1b3726 Attempt to fix VS2015 build breakage from r354517. NFCI.
llvm-svn: 354545
2019-02-21 04:55:31 +00:00
Stephane Moore 3eea706e3e [clang-tidy] Make google-objc-function-naming ignore implicit functions 🙈
Summary:
Implicit functions are outside the control of source authors and should
be exempt from style restrictions.

Tested via running clang tools tests.

This is an amended followup to https://reviews.llvm.org/D57207

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: jdoerfert, xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 354534
2019-02-21 00:34:01 +00:00
Jonas Toth 32d5b252b9 [clang-tidy] refactor ExceptionAnalyzer further to give ternary answer
Summary:
The analsis on the throwing behvaiour on functions and statements gave only
a binary answer whether an exception could occur and if yes which types are
thrown.
This refactoring allows keeping track if there is a unknown factor, because the
code calls to some functions with unavailable source code with no `noexcept`
information.
This 'potential Unknown' information is propagated properly and can be queried
separately.

Reviewers: lebedev.ri, aaron.ballman, baloghadamsoftware, alexfh

Reviewed By: lebedev.ri, baloghadamsoftware

Subscribers: xazax.hun, rnkovacs, a.sidorin, Szelethus, donat.nagy, dkrupp, cfe-commits

Tags: #clang

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

llvm-svn: 354517
2019-02-20 21:04:36 +00:00
Ilya Biryukov fc83aea6a9 [clangd] Fix a crash in Selection
Summary:
The assertion checking that a range of a node is a token range does
not hold in case of "split" tokens, e.g. between two closing template
argument lists (`vector<vector<int>>`).

Reviewers: kadircet, sammccall

Reviewed By: kadircet

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

Tags: #clang

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

llvm-svn: 354507
2019-02-20 19:26:39 +00:00
Ilya Biryukov 2754942cba [clangd] Store index in '.clangd/index' instead of '.clangd-index'
Summary: To take up the .clangd folder for other potential uses in the future.

Reviewers: kadircet, sammccall

Reviewed By: kadircet

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

Tags: #clang

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

llvm-svn: 354505
2019-02-20 19:08:06 +00:00
Yan Zhang 19bceda879 Update property prefix regex to allow numbers.
Subscribers: jfb, cfe-commits

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

llvm-svn: 354485
2019-02-20 17:32:41 +00:00
Ilya Biryukov 97ed3c1e47 [clangd] Fix a typo. NFC
The documentation for -index-file mentioned clang-index instead of
clangd-indexer.

llvm-svn: 354456
2019-02-20 12:31:44 +00:00
Kadir Cetinkaya 592e7c9b0e [clangd] Revert r354442 and r354444
Looks like sysroot is only working on linux.

llvm-svn: 354453
2019-02-20 11:45:20 +00:00
Kadir Cetinkaya 60ba9b4460 [clangd] Try to fix windows build bots
llvm-svn: 354444
2019-02-20 10:32:04 +00:00
Kadir Cetinkaya 30d340839c [clangd] Testcase for bug 39811
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 354442
2019-02-20 09:41:26 +00:00
Ilya Biryukov 93dfb45256 [clangd] Add an option in the code to not display number of fixes
Summary:
Only to the APIs, which are used by our embedders.
We do not plan to add a user-facing option for this.

Reviewers: sammccall, ioeric

Reviewed By: sammccall

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

Tags: #clang

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

llvm-svn: 354349
2019-02-19 16:50:37 +00:00
Eric Liu 4df070a5e3 [clangd] Handle unresolved scope specifier when fixing includes.
Summary:
In the following examples, "clangd" is unresolved, and the fixer will try to fix
include for `clang::clangd`; however, clang::clangd::X is usually intended. So
when handling a qualifier that is unresolved, we change the unresolved name and
scopes so that the fixer will fix "clang::clangd::X" in the following example.
```
  namespace clang {
  	clangd::X
	~~~~~~
  }
  // or
  clang::clangd::X
         ~~~~~~
```

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

llvm-svn: 354330
2019-02-19 14:32:22 +00:00
Kadir Cetinkaya 9b4db445ce [clangd] Add tests for template specializations
Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

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

llvm-svn: 354272
2019-02-18 14:23:19 +00:00
Eric Liu b355802910 [clangd] Cache include fixes for diagnostics caused by the same unresolved name or incomplete type.
Summary:
Multiple diagnostics can be caused by the same unresolved name or incomplete type,
especially if the code is copy-pasted without #includes. The cache can avoid making
repetitive index requests, and thus reduce latency and allow more diagnostics to be
fixed (we limit the number of index requests for each parse).

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

llvm-svn: 354268
2019-02-18 13:12:10 +00:00
Alexander Kornienko 958837c640 [clang-tidy] Fix links in docs.
llvm-svn: 354266
2019-02-18 12:50:35 +00:00
Bruno Ricci b73b5cda62 [clang-tidy][NFCI] DanglingHandleCheck: Remove a superflous IgnoreParenImpCasts
ExprWithCleanups is currently not skipped by IgnoreParenImpCasts, but is skipped
by IgnoreImpCasts. In view of fixing this inconsistency in D57267, remove the
IgnoreParenImpCasts between the ReturnStmt and the ExprWithCleanups which
is not needed since ExprWithCleanups is always created as a direct child of
ReturnStmt (by inspection of each ReturnStmt::Create in Sema/SemaStmt.cpp).

NFC intended.

llvm-svn: 354228
2019-02-17 18:21:54 +00:00
Stephane Moore 358f99c7fe [clang-tidy] Delete obsolete objc-property-declaration options ✂️
Summary:
The Acronyms and IncludeDefaultAcronyms options were deprecated in
https://reviews.llvm.org/D51832. These options can be removed.

Tested by running the clang-tidy tests.

This is an amended resubmission of https://reviews.llvm.org/D56945.

Reviewers: Eugene.Zelenko, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 354195
2019-02-16 04:27:12 +00:00
Sam McCall 0446b40b63 [clangd] Unlink VFS working dir from OS working dir. Reland of r351051
llvm-svn: 354116
2019-02-15 11:04:25 +00:00
Volodymyr Sapsai 8b982cb8a9 [clang-tidy] Mention language version in test explicitly.
"modernize-use-using" check is applicable only to C++11 and later. Spell it out
to avoid relying on default language version.

rdar://problem/47932196

llvm-svn: 354069
2019-02-14 22:37:30 +00:00
Eric Liu da2ed56fea [clangd] Handle a few more diag kinds in include fixer.
Reviewers: sammccall

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

Tags: #clang

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

llvm-svn: 353926
2019-02-13 08:58:54 +00:00
Kadir Cetinkaya 87731440d4 [clangd] Fix a lit-test.
Summary:
Fixes https://bugs.llvm.org/show_bug.cgi?id=40593.
Non-percent-encoded chars doesn't cause any problems on the input-side since we
assume everything after authority section is data and don't interpret them as
delimeters.

Reviewers: sammccall

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

Tags: #clang

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

llvm-svn: 353857
2019-02-12 16:54:47 +00:00
Sam McCall 905438a4b5 [clangd] Fix use-after-free in XRefs
llvm-svn: 353821
2019-02-12 10:38:45 +00:00
Francis Visoiu Mistrih 1608c12027 [NFC][clangd] Remove unused lambda capture
Avoid this warning:

llvm/clang-tools-extra/clangd/ClangdServer.cpp:365:23: warning: lambda
capture 'this' is not used [-Wunused-lambda-capture]

  auto Action = [Sel, this](decltype(CB) CB, std::string File,
                    ~~^~~~
1 warning generated.

llvm-svn: 353760
2019-02-11 22:36:47 +00:00
Haojian Wu e64ee7c645 Revamp the "[clangd] Format tweak's replacements"
Summary:
This patch contains two parts:

1) reverts commit r353306.
2) move the format logic out from tweaks, keep tweaks API unchanged.

Reviewers: sammccall, ilya-biryukov

Reviewed By: ilya-biryukov

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

Tags: #clang

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

llvm-svn: 353712
2019-02-11 15:18:11 +00:00
Eric Liu d11fbf523d [clangd] Prefer location from codegen files when merging symbols.
Summary:
For example, if an index symbol has location in a .proto file and an AST symbol
has location in a generated .proto.h file, then we prefer location in .proto
which is more meaningful to users.

Also use `mergeSymbols` to get the preferred location between AST location and index location in go-to-def.

Reviewers: sammccall

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

Tags: #clang

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

llvm-svn: 353708
2019-02-11 15:05:29 +00:00
Kadir Cetinkaya 429022995b [clangd] Index parameters in function decls
Reviewers: hokein

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

Tags: #clang

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

llvm-svn: 353696
2019-02-11 13:03:08 +00:00
Kadir Cetinkaya cf13bfee00 [clangd] Fix broken windows build bots.
llvm-svn: 353694
2019-02-11 13:01:47 +00:00
Kadir Cetinkaya db7fbcb038 [clangd] Make system header mappings available for PreambleParsedCallback
Summary:
SystemHeaderMappings were added only after takeIncludes call, which
resulted in getting mapping on main file ast updates but not on preamble ast
updates.
Fixes https://github.com/clangd/clangd/issues/8

Reviewers: hokein

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

Tags: #clang

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

llvm-svn: 353687
2019-02-11 10:31:13 +00:00
Malcolm Parsons 297b6a2b6e [clang-tidy] Don't use assignment for value-initialized enums
Summary:
The modernize-use-default-member-init check crashes when trying to
create an assignment value for a value-initialized enum because it isn't a
BuiltinType.
An enum cannot be initialized by assigning 0 to it unless a cast is added.
It could be initialized with an enumerator with the value 0, but there might not
be one.
Avoid these issues by ignoring the UseAssignment setting for value-initialized
enums.

Fixes PR35050.

Reviewers: aaron.ballman, alexfh, JonasToth

Reviewed By: JonasToth

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

llvm-svn: 353554
2019-02-08 19:44:42 +00:00
Paul Hoad 6bfd721571 [clang-tidy] Add options to bugprone-argument-comment to add missing argument comments to literals
bugprone-argument-comment only supports identifying those comments which do not match the function parameter name

This revision add 3 options to adding missing argument comments to literals (granularity on type is added to control verbosity of fixit)

```
CheckOptions:
  - key:             bugprone-argument-comment.CommentBoolLiterals
    value:           '1'
  - key:             bugprone-argument-comment.CommentFloatLiterals
    value:           '1'
  - key:             bugprone-argument-comment.CommentIntegerLiterals
    value:           '1'
  - key:             bugprone-argument-comment.CommentStringLiterals
    value:           '1'
  - key:             bugprone-argument-comment.CommentCharacterLiterals
    value:           '1'
  - key:             bugprone-argument-comment.CommentUserDefinedLiterals
    value:           '1'
  - key:             bugprone-argument-comment.CommentNullPtrs
    value:           '1'
```

After applying these options, literal arguments will be preceded with /*ParameterName=*/

Reviewers: JonasToth, Eugene.Zelenko, alexfh, hokein, aaron.ballman

Reviewed By: aaron.ballman, Eugene.Zelenko

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

llvm-svn: 353535
2019-02-08 17:00:01 +00:00
Yitzhak Mandelbaum f6be5573dc [clang-tidy][NFC] Fix typo.
Fix placement of comma from previous (test) commit.

llvm-svn: 353525
2019-02-08 15:05:57 +00:00
Yitzhak Mandelbaum 01d6bfc94d [clang-tidy][NFC] Test commit. Add missing comma.
llvm-svn: 353523
2019-02-08 14:57:22 +00:00