| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
llvm-svn: 214703
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
definition is visible.
Summary:
This allows us to copy the parameter name from the definition (as a comment)
or insert /*unused*/ in both places.
Reviewers: alexfh, klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4772
llvm-svn: 214701
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: pcc, klimek
Reviewed By: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4765
llvm-svn: 214621
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
compilation database and makes it behave consistently with other clang tools.
Reviewers: klimek, pcc
Reviewed By: pcc
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4763
llvm-svn: 214607
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
but doesn't delegate.
Summary:
class Foo {
Foo() {
Foo(42); // oops
}
Foo(int);
};
This is valid code but it does nothing and we can't emit a warning in clang
because there might be side effects. The checker emits a warning for this
pattern and also for base class initializers written in this style.
There is some overlap with the unused-rtti checker but they follow different
goals and fire in different places most of the time.
Reviewers: alexfh, djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4667
llvm-svn: 214397
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
function the callback points to.
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4722
llvm-svn: 214307
|
|
|
|
|
|
|
|
| |
It doesn't make sense to suggest 'virtual' as clang-tidy would complain
about that on the next iteration (we are never issuing warnings for the
base function).
llvm-svn: 214063
|
|
|
|
|
|
|
| |
Most of the changes are mechanic std::unique_ptr insertions. All leaks were
detected by LeakSanitizer.
llvm-svn: 213851
|
|
|
|
| |
llvm-svn: 213845
|
|
|
|
| |
llvm-svn: 213740
|
|
|
|
|
|
| |
Otherwise we'll get confusing messages from FileCheck instead of seeing the real issue.
llvm-svn: 213739
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ASTMatchers currently have problems mixing bound TypeLoc nodes with Decl/Stmt
nodes. That should be fixed soon but for this checker there we only need the
TypeLoc to generate a fixit so postpone the potentially heavyweight AST walking
until after we know that we're going to emit a warning.
This is covered by existing test cases.
Original message:
[clang-tidy] Add a check for RAII temporaries.
This tries to find code similar that immediately destroys
an object that looks like it's trying to follow RAII.
{
scoped_lock(&global_mutex);
critical_section();
}
This checker will have false positives if someone uses this pattern
to legitimately invoke a destructor immediately (or the statement is
at the end of a scope anyway). To reduce the number we ignore this
pattern in macros (this is heavily used by gtest) and ignore objects
with no user-defined destructor.
llvm-svn: 213738
|
|
|
|
| |
llvm-svn: 213722
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This tries to find code similar that immediately destroys
an object that looks like it's trying to follow RAII.
{
scoped_lock(&global_mutex);
critical_section();
}
This checker will have false positives if someone uses this pattern
to legitimately invoke a destructor immediately (or the statement is
at the end of a scope anyway). To reduce the number we ignore this
pattern in macros (this is heavily used by gtest) and ignore objects
with no user-defined destructor.
Reviewers: alexfh, djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4615
llvm-svn: 213647
|
|
|
|
|
|
|
|
|
| |
has a explicit template argument.
This required a rather ugly workaround for a problem in ASTMatchers where
callee() is only overloaded for Stmt and Decl but not for Expr.
llvm-svn: 213509
|
|
|
|
|
|
| |
'final' should really be used with care.
llvm-svn: 213501
|
|
|
|
|
|
|
|
|
| |
This reverts commit r213308.
Reverting to have some on-list discussion/confirmation about the ongoing
direction of smart pointer usage in the LLVM project.
llvm-svn: 213324
|
|
|
|
| |
llvm-svn: 213308
|
|
|
|
| |
llvm-svn: 213245
|
|
|
|
|
|
| |
dependent values.
llvm-svn: 213238
|
|
|
|
| |
llvm-svn: 213233
|
|
|
|
|
|
| |
The clang rewriter is now a core facility.
llvm-svn: 213172
|
|
|
|
|
|
|
|
|
| |
negative-sized memsets.
memset(x, -1, 0) is still useless but swapping makes no sense here. Just emit
a warning.
llvm-svn: 213157
|
|
|
|
|
|
|
| |
It doesn't make sense to suggest swapping the arguments here but it's
still useless code
llvm-svn: 213156
|
|
|
|
|
|
|
|
|
|
|
|
| |
If there's memset(x, y, 0) in the code it's most likely a mistake. The
checker suggests a fix-it to swap 'y' and '0'.
I think this has the potential to be promoted into a general clang warning
after some testing in clang-tidy.
Differential Revision: http://reviews.llvm.org/D4535
llvm-svn: 213155
|
|
|
|
|
|
|
|
|
|
| |
This change contains of two checkers that warn about
1. anonymous namespaces in header files.
2. 'using namespace' directives everywhere.
Differential Revision: http://reviews.llvm.org/D4523
llvm-svn: 213153
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: bkramer
Reviewed By: bkramer
Subscribers: cfe-commits, sbenza
Differential Revision: http://reviews.llvm.org/D4534
llvm-svn: 213149
|
|
|
|
| |
llvm-svn: 213147
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
Those are considered unsafe and should be replaced with simple pointers or
full copies. It recognizes both std::string and ::string.
Reviewers: alexfh, djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4522
llvm-svn: 213133
|
|
|
|
|
|
|
|
|
| |
Imagine, hypothetically, that you had a build of clang-tidy that enabled
the google-* checks by default. If you had such a binary, then this
test would fail. Making it pass in that configuration isn't such a bad
thing.
llvm-svn: 213085
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
We still allow the escape hatch foo(int /*x*/) and also suggest this
in a fixit. This is more powerful than the corresponding cpplint.py check
it also flags functions with multiple arguments as naming all arguments is
recommended by the google style guide.
Reviewers: alexfh, djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4518
llvm-svn: 213075
|
|
|
|
| |
llvm-svn: 213068
|
|
|
|
|
|
|
|
|
|
| |
operator&
This handles both methods and freestanding overloads.
Differential Revision: http://reviews.llvm.org/D4498
llvm-svn: 213067
|
|
|
|
|
|
| |
I checked this with Release+Asserts on x86_64-mingw32. Please restore partially if this were overkill.
llvm-svn: 213064
|
|
|
|
|
|
|
|
|
|
|
| |
Those may be incompatible with C++11 and are unnecessary. We suggest
removing the template arguments when they match the types of the make_pair
arguments or replace it with std::pair and explicit template arguments when
not.
Differential Revision: http://reviews.llvm.org/D4497
llvm-svn: 213058
|
|
|
|
| |
llvm-svn: 212994
|
|
|
|
|
|
|
|
|
| |
This looks for swapped arguments by looking at implicit conversions of arguments
void Foo(int, double);
Foo(1.0, 3); // Most likely a bug
llvm-svn: 212942
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: bkramer
Reviewed By: bkramer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4494
llvm-svn: 212941
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary:
This patch implements a subset of possible replacements of C-style
casts with const_cast/static_cast/reinterpret_cast. This should cover a large
portion of cases in real code. Handling of a few more cases may be implemented
eventually.
Reviewers: sbenza, djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4478
llvm-svn: 212924
|
|
|
|
| |
llvm-svn: 212920
|
|
|
|
| |
llvm-svn: 212919
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
check_clang_tidy_fix.sh.
Reviewers: sbenza, djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4480
llvm-svn: 212876
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
in D4462
Reviewers: djasper, sbenza, bkramer
Reviewed By: bkramer
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4463
llvm-svn: 212814
|
|
|
|
| |
llvm-svn: 212811
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The goal is to find code like the example below, which is likely a typo
where someone meant to write "if (*b)".
bool *b = SomeFunction();
if (b) {
// b never dereferenced
}
This checker naturally has a relatively high false positive rate so it
applies some heuristics to avoid cases where the pointer is checked for
nullptr before being written.
Differential Revision: http://reviews.llvm.org/D4458
llvm-svn: 212797
|
|
|
|
| |
llvm-svn: 212755
|
|
|
|
| |
llvm-svn: 212658
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: This reduces duplication of test code and improves locality of checks.
Reviewers: sbenza, djasper
Reviewed By: sbenza, djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D4437
llvm-svn: 212653
|
|
|
|
| |
llvm-svn: 212593
|
|
|
|
| |
llvm-svn: 212549
|