Use the LLVM_UTILS_PROVIDED variable to determine whether test tool
dependencies should be exposed for clang-tools-extra tests. If clang is
being built stand-alone and LLVM test tools (FileCheck, count and not)
are installed, the top-level CMakeLists.txt of clang sets this variable
to indicate that they will not be built as a part of this build,
and therefore no dependencies should be emitted for them. This fixes
the dependency errors when building clang stand-alone with tests
enabled.
Differential Revision: https://reviews.llvm.org/D29851
llvm-svn: 297806
Clangd is often waiting for input on getline as it awaits requests. If the
getline is interrupted, it causes the system call (read) to fail and the EINTR
error to be set. This can be seen when attaching a debugger such as LLDB on
macOS. On macOS (and possibly other operating systems), this system call is not
restarted after interruption but on Linux it is restarted which is why
attaching a debugger does work correctly there.
The solution is to work around the non-restarting system call by checking the
errno for EINTR when the stream fails and try again. This should be safe on all
Unixish platforms.
See also http://bugs.llvm.org/show_bug.cgi?id=32149 for some background
discussion.
Patch by Marc-Andre Laperle!
Differential Revision: https://reviews.llvm.org/D30675
llvm-svn: 297779
Summary:
Add fuzzy SymbolIndex, where identifier needn't match exactly.
The purpose for this is global autocomplete in clangd. The query will be a
partial identifier up to the cursor, and the results will be suggestions.
It's in include-fixer because:
- it handles SymbolInfos, actually SymbolIndex is exactly the right interface
- it's a good harness for lit testing the fuzzy YAML index
- (Laziness: we can't unit test clangd until reorganizing with a tool/ dir)
Other questionable choices:
- FuzzySymbolIndex, which just refines the contract of SymbolIndex. This is
an interface to allow extension to large monorepos (*cough*)
- an always-true safety check that Identifier == Name is removed from
SymbolIndexManager, as it's not true for fuzzy matching
- exposing -db=fuzzyYaml from include-fixer is not a very useful feature, and
a non-orthogonal ui (fuzziness vs data source). -db=fixed is similar though.
Reviewers: bkramer
Subscribers: cfe-commits, mgorny
Differential Revision: https://reviews.llvm.org/D30720
llvm-svn: 297630
Summary:
Remove line number from Symbol identity.
For our purposes (include-fixer and clangd autocomplete), function overloads
within the same header should mostly be treated as a single combined symbol.
We may want to track individual occurrences (line number, full type info)
and aggregate this during mapreduce, but that's not done here.
Reviewers: hokein, bkramer
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D30685
llvm-svn: 297371
Summary:
I've added a test case that (without the fix) triggers the assertion,
which happens when a move happens in an implicitly called conversion
operator.
This patch also fixes nondeterministic behavior in the source code
location reported for the move when the move is constained in an init list;
this was causing buildbot failures in the previous attempt to submit
this patch (see D30569 and rL297004).
Reviewers: alexfh
Reviewed By: alexfh
Subscribers: Eugene.Zelenko, JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D30650
llvm-svn: 297272
Summary: When invoking clang-include-fixer-at-point, the QuerySymbolInfos point to offset 0, length 0. Rather than showing a hidden overlay, do not show any overlay at all for zero-length symbols.
Patch by Torsten Marek!
Reviewers: hokein, klimek
Reviewed By: hokein
Differential Revision: https://reviews.llvm.org/D30577
llvm-svn: 297010
Summary:
I've added a test case that (without the fix) triggers the assertion,
which happens when a move happens in an implicitly called conversion
operator.
Reviewers: alexfh
Reviewed By: alexfh
Subscribers: JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D30569
llvm-svn: 297004
* suggest static_cast instead of reinterpret_cast for casts from void*
* top-level const doesn't need a const_cast
* don't emit a separate "possibly redundant cast" warning, instead suggest
static_cast (in C++ only) and add a little hint to consider removing the cast
llvm-svn: 296753
Summary:
Hello everybody,
this is an incremental patch for the NoMalloc-Checker I wrote. It allows to configure the memory-management functions, that are checked,
This might be helpful for a code base with custom functions in use, or non-standard functionality, like posix_memalign.
Reviewers: aaron.ballman, hokein, alexfh
Reviewed By: aaron.ballman, alexfh
Subscribers: sbenza, nemanjai, JDevlieghere
Tags: #clang-tools-extra
Patch by Jonas Toth!
Differential Revision: https://reviews.llvm.org/D28239
llvm-svn: 296734
Summary:
This uses CodeActions to show 'apply fix' actions when code actions are
requested for a location. The actions themselves make use of a
clangd.applyFix command which has to be implemented on the editor side. I
included an implementation for vscode.
This also adds a -run-synchronously flag which runs everything on the main
thread. This is useful for testing.
Reviewers: krasimir
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D30498
llvm-svn: 296636
Summary:
Previously, the insertion points would conflict with the old namespace
deletion.
Reviewers: hokein
Reviewed By: hokein
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D30490
llvm-svn: 296604
Summary:
Add an option to function-size to warn about high parameter counts.
This might be relevant for cppcoreguidelines and the safety module as well. Since the safety module is not landed in master already, i did not create an alias, but that can be done later as well.
Reviewers: sbenza, alexfh, hokein
Reviewed By: alexfh, hokein
Subscribers: JDevlieghere
Patch by Jonas Toth!
Differential Revision: https://reviews.llvm.org/D29561
llvm-svn: 296599
Summary:
Fix generated by modernize-use-override caused syntax error when method
used try-statement as a body. `override` keyword was inserted after last
declaration token which happened to be a `try` keyword.
This fixes PR27119.
Reviewers: ehsan, djasper, alexfh
Reviewed By: alexfh
Subscribers: JDevlieghere, cfe-commits
Tags: #clang-tools-extra
Patch by Paweł Żukowski!
Differential Revision: https://reviews.llvm.org/D30002
llvm-svn: 296598
Summary:
Add usage count to find-all-symbols.
FindAllSymbols now finds (most!) main-file usages of the discovered symbols.
The per-TU map output has NumUses=0 or 1 (only one use per file is counted).
The reducer aggregates these to find the number of files that use a symbol.
The NumOccurrences is now set to 1 in the mapper rather than being inferred by
the reducer, for consistency.
The idea here is to use NumUses for ranking: intuitively number of files that
use a symbol is more meaningful than number of files that include the header.
Reviewers: hokein, bkramer
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D30210
llvm-svn: 296446
This allows the install target to also install clangd to bin, so that
it can be deployed and used outside the build tree.
Patch by Marc-Andre Laperle!
Differential Revision: https://reviews.llvm.org/D30425
llvm-svn: 296390
`clang-include-fixer--insert-line` has an off-by-one error because it
uses `(goto-char (point-min)) (forward-char chars)`, which is (goto-char
(1+ chars))`. Because of this, when the first difference was on an empty
line (i.e. an include was appended to the block of includes), the
pointer in the `to` buffer would be on the next line.
Also wrapped calls inside another process sentinel inside `with-local-quit`.
Patch by Torsten Marek.
Differential Revision: https://reviews.llvm.org/D30292
llvm-svn: 295988
1. Quitting inside a process sentinel is not allowed, but the sentinel invokes
completion, where the user is free to hit C-g. By wrapping the call in
with-local-quit, the process sentinel invocation can finish without triggering
an error
2. Invoke completing-read instead of ido-completing-read, since this may
interfere with user customizations to completing-read-function. The user should
use something like ido-ubiquitous if ido completion is wanted
3. Compare the string returned from completion with string=, since it may be a
copy of the original string in the collection
Patch by Torsten Marek.
llvm-svn: 295818
This patch also adds a new function clang-include-fixer-from-symbol, which prompts the user for a symbol to resolve and include.
Patch by Torsten Marek.
llvm-svn: 295814
The check doesn't really know if the code it is warning about came before
or after the header guard, so phrase it more neutral instead of complaining
about code before the header guard. The location for the warning is still
not optimal, but I don't think fixing that is worth the effort, the
preprocessor doesn't give us a better location.
Differential Revision: https://reviews.llvm.org/D30191
llvm-svn: 295715
Summary:
This flag allows specifying a custom path for the compilation
database. Unfortunately we can't use the -p flag like other
clang-tidy tools because it's already taken.
Reviewers: alexfh
Subscribers: JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D29806
llvm-svn: 295482
The 'Limitations' section in thedocumentation for
readability-misleading-indentation should be a subsection, as otherwise the link
to 'Limitations' isn't indented in the 'Clang-Tidy Checks' documentation page.
llvm-svn: 295471