Summary:
This requires an accessible compilation database. The parsing is done
asynchronously on a separate thread.
Reviewers: klimek, krasimir
Subscribers: cfe-commits, mgorny
Differential Revision: https://reviews.llvm.org/D29886
llvm-svn: 295180
Summary:
The misc-unconventional-assign-operator check had a false positive
warning when the 'operator*' in 'return *this' was unresolved.
Change matcher to allow calls to unresolved operator.
Fixes PR31531.
Reviewers: alexfh, aaron.ballman
Subscribers: JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D29393
llvm-svn: 295176
Summary:
Users might get confused easily when they see the check's message on
full template function speciliations.
Add a note to the output message, which mentions these kind of function
specializations are treated as regular functions.
Reviewers: alexfh
Reviewed By: alexfh
Subscribers: JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D29928
llvm-svn: 295048
I have made a small fix for readability-delete-null-pointer check so it also checks for class members.
Example of case that it fixes
```
struct A {
void foo() {
if(mp)
delete mp;
}
int *mp;
};
```
Reviewers: JDevlieghere, aaron.ballman, alexfh, malcolm.parsons
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D29726
llvm-svn: 294912
LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
to correctly link the threading library when needed. Unfortunately
`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
and therefore can't be used when configuring out-of-tree builds. This causes
such builds to fail since `pthread` isn't being correctly linked.
This patch attempts to fix that problem by renaming and exporting
`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
because It seemed likely to cause collisions with downstream users of
`LLVMConfig.cmake`.
llvm-svn: 294690
Summary:
This new flag instructs clang-tidy to not output anything
except for errors and warnings. This makes it easier to
script clang-tidy to run as part of external build systems.
Reviewers: bkramer, alexfh, klimek
Subscribers: JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D29661
llvm-svn: 294607
Summary:
These flags allow specifying extra arguments to the tool's command
line which don't appear in the compilation database.
Reviewers: alexfh, klimek, bkramer
Subscribers: JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D29699
llvm-svn: 294491
I didn't find this because my main development machine still happens to
use libstdc++ with the broken C++11 ABI, which has a global empty
string.
llvm-svn: 294309
clangd is a language server protocol implementation based on clang. It's
supposed to provide editor integration while not suffering from the
confined ABI of libclang.
This implementation is limited to the bare minimum functionality of
doing (whole-document) formatting and rangeFormatting. The JSON parsing
is based on LLVM's YAMLParser but yet most of the code of clangd is
currently dealing with JSON serialization and deserialization.
This was only tested with VS Code so far, mileage with other LSP clients
may vary.
Differential Revision: https://reviews.llvm.org/D29451
llvm-svn: 294291
Now for real. The use case supported previously is used by approximately nobody.
What's needed is support for matching argument comments in EXPECT_xxx calls to
the names of parameters of the mocked methods.
llvm-svn: 294193
Summary:
This fixes mismatch between template decls and template specialization decls.
Also added a few more test cases.
Reviewers: bkramer
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D29447
llvm-svn: 293897
Summary:
For example, when we change 'na' to "nb::nc", we need to add leading '::' to
references "::nc::X" in the changed namespace.
Reviewers: bkramer
Reviewed By: bkramer
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D29176
llvm-svn: 293182
Fixes PR30964. The old behavior can be achieved using a setting.
Patch by: Andras Leitereg!
Differential Revision: https://reviews.llvm.org/D28667
llvm-svn: 292938
Summary:
Test cases I've added in review D26218 were too brittle and weren't working properly.
This patch fixes this.
Reviewers: alexfh
Reviewed By: alexfh
Subscribers: cfe-commits
Patch by Nikita Kakuev!
Differential Revision: https://reviews.llvm.org/D26466
llvm-svn: 292926
Summary:
The performance-unnecessary-value-param check mangled inherited
constructors, as the constructors' parameters do not have useful source
locations. Fix this by ignoring implicit functions.
Fixes PR31684.
Reviewers: flx, alexfh, aaron.ballman
Subscribers: madsravn, JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D29018
llvm-svn: 292786
Summary:
Docs for clang::Decl and clang::TemplateSpecializationType have
not been generated since LLVM_ALIGNAS was added to them.
Tell Doxygen to expand LLVM_ALIGNAS to nothing as described at
https://www.stack.nl/~dimitri/doxygen/manual/preprocessing.html
Reviewers: aaron.ballman, klimek, alexfh
Subscribers: ioeric, cfe-commits
Differential Revision: https://reviews.llvm.org/D28850
llvm-svn: 292484
Summary:
These flags allow specifying extra arguments to the tool's command
line which don't appear in the compilation database.
Reviewers: alexfh
Differential Revision: https://reviews.llvm.org/D28334
llvm-svn: 292415
This is could happen in cases involving macros and we don't want to
return an invalid fixit for it or a confusing error message with no
fixit.
llvm-svn: 292405
Summary:
Also ignore helpers which are defined in macro. Currently clang-move doesn't
handle macro well enough, especiall for complex macros. This patch will ignore
declarations in macros to make the behavior of clang-move more correct.
Reviewers: ioeric
Reviewed By: ioeric
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D28774
llvm-svn: 292207
- The include fixer plugin does not directly depend on pthread, but can
pick up pthread references transitively through inlining. Just add
pthreads to the linked libs unconditionally.
- MSVC emits bogus warnings when including <future> and building without
exceptions. Blacklist the warnings explicitly.
llvm-svn: 291892
Summary:
rL270567 excluded trivially copyable types from being moved by
modernize-pass-by-value, but it didn't exclude references to them.
Change types used in the tests to not be trivially copyable.
Reviewers: madsravn, aaron.ballman, alexfh
Subscribers: JDevlieghere, cfe-commits
Differential Revision: https://reviews.llvm.org/D28614
llvm-svn: 291796
Summary:
Prevents misclassifying includes based on the command-line filename (e.g. if a project is in a subdirectory).
This is slightly more robust than the additional duplicate detection, however the current classification scheme is still kind of brittle for a lot of code.
Reviewers: hokein, alexfh
Subscribers: cfe-commits, #clang-tools-extra
Patch by Julian Bangert!
Differential Revision: https://reviews.llvm.org/D26015
llvm-svn: 291767
Summary:
Fix no std::function index.
Previously, we don't index all the template specialization declarations of functions and classes (Because we assume that template functions/classes are indexed by their template declarations), but this is not always true in some cases like `std::function` which only has a partial template specialization declaration.
Reviewers: ioeric, bkramer
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D27920
llvm-svn: 291669
Instead of just using popularity, we also take into account how similar the
path of the current file is to the path of the header.
Our first approach is to get popularity into a reasonably small scale by taking
log2 (which is roughly intuitive to how humans would bucket popularity), and
multiply that with the number of matching prefix path fragments of the included
header with the current file.
Note that currently we do not take special care for unclean paths containing
"../" or "./".
Differential Revision: https://reviews.llvm.org/D28548
llvm-svn: 291664
We don't actually need the index until parse time, so fetch it in the
background and start parsing. By the time it is actually needed it's
likely that the loading phase has completed in the background.
llvm-svn: 291446
Aleksey Shlyapnikov pointed out the memory leak I'd introduced, so
recommitted the clang change with a fix for that.
This reapplies r291186, reverted in r291251.
llvm-svn: 291272
Summary:
Default member initializers cannot refer to constructor parameters, but modernize-default-member-init was trying to when the default constructor had default arguments.
Change the check to ignore default arguments to the default constructor.
Fixes PR31524.
Reviewers: alexfh, aaron.ballman
Subscribers: cfe-commits, JDevlieghere, Eugene.Zelenko
Differential Revision: https://reviews.llvm.org/D28287
llvm-svn: 290972
Summary: Previously, a `\n` might be left in the old namespace and thus not copied to the new namespace, which is bad.
Reviewers: hokein
Subscribers: alexshap, cfe-commits
Differential Revision: https://reviews.llvm.org/D28282
llvm-svn: 290966
Add a field indicating the associated check for every replacement to the YAML
report generated with the '-export-fixes' option. Update
clang-apply-replacements to handle the new format.
Patch by Alpha Abdoulaye!
Differential revision: https://reviews.llvm.org/D26137
llvm-svn: 290893
Summary:
Instead of moving all the helper declarations blindly, this patch
implements an AST-based call graph solution to make clang-move only move used
helper decls to new.cc and remove unused decls in old.cc.
Depends on D27674.
Reviewers: ioeric
Subscribers: mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D27673
llvm-svn: 290873
Summary:
The documentation assumed expertise with FileCheck; many clang-tidy check
authors may not have significant exposure to FileCheck, and so it's worth
spending a few more words here to spell things out.
Reviewers: alexfh
Subscribers: cfe-commits, JDevlieghere
Differential Revision: https://reviews.llvm.org/D28189
llvm-svn: 290838
This check detects and fixes redundant null checks before deletes.
Patch by: Gergely Angeli!
Differential Revision: https://reviews.llvm.org/D21298
llvm-svn: 290784
I have a created a new check for clang tidy: misc-string-compare. This will check for incorrect usage of std::string::compare when used to check equality or inequality of string instead of the string equality or inequality operators.
Example:
```
std::string str1, str2;
if (str1.compare(str2)) {
}
```
Reviewers: hokein, aaron.ballman, alexfh, malcolm.parsons
Subscribers: xazax.hun, Eugene.Zelenko, cfe-commits, malcolm.parsons, Prazek, mgorny, JDevlieghere
Differential Revision: https://reviews.llvm.org/D27210
llvm-svn: 290747
The checker detects various cases when an enum is probably misused
(as a bitmask).
Patch by: Peter Szecsi!
Differential Revision: https://reviews.llvm.org/D22507
llvm-svn: 290600