Replace x.reset(y.release()); with x = std::move(y);
If y is rvalue, replace with x = y; instead.
http://reviews.llvm.org/D6485
Patch by Alexey Sokolov!
llvm-svn: 223460
Summary:
According to the Google C++ Style Guide, constructors taking a single
std::initializer_list<> should not be marked explicit.
This change also changes the messages according to conventions used in Clang
diagnostics: no capitalization of the first letter, no trailing dot.
Reviewers: djasper
Reviewed By: djasper
Subscribers: curdeius, cfe-commits
Differential Revision: http://reviews.llvm.org/D6427
llvm-svn: 222878
Summary:
The google-readability-namespace-comments/llvm-namespace-comment
warnings are quite confusing when they appear at the beginning of a long
namespace and the closing brace is not in sight.
For convenience added notes pointing to the start of the namespace.
Reviewers: klimek
Reviewed By: klimek
Subscribers: curdeius, cfe-commits
Differential Revision: http://reviews.llvm.org/D6251
llvm-svn: 222145
Summary:
Added -fix-errors option to allow applying fixes when compiler errors
are present. Without this flag -fix would bail out if there are compiler errors.
This is needed to avoid applying wrong fixes if Clang fails to recover from
compilation errors correctly.
Reviewers: djasper, klimek
Reviewed By: klimek
Subscribers: curdeius, cfe-commits
Differential Revision: http://reviews.llvm.org/D6059
llvm-svn: 221152
Summary: Make the script suitable for checking just messages. Move most of the tests to use it. Clean up the tests: shorten messages, insert line numbers, remove unnecessary RUN: lines, etc.
Reviewers: klimek
Reviewed By: klimek
Subscribers: curdeius, cfe-commits
Differential Revision: http://reviews.llvm.org/D5989
llvm-svn: 220634
Summary:
Register readability checks in a separate module. Renamed the checks
and test file names accordingly.
Reviewers: djasper, klimek
Reviewed By: klimek
Subscribers: curdeius, cfe-commits
Differential Revision: http://reviews.llvm.org/D5936
llvm-svn: 220631
Summary:
This patch allows modules to specify default options for the checks
defined in them. This way a sufficiently configurable check can be registered in
multiple modules with different default options. E.g. the SpacesBeforeComments
option may be set to 1 for the "llvm-namespace-comments" check and to 2 for the
"google-readability-namespace-comment" check without modifying or extending the
check code.
This patch also registers the google-readability-braces-around-statements check
with suitable defaults.
Reviewers: djasper
Reviewed By: djasper
Subscribers: curdeius, cfe-commits
Differential Revision: http://reviews.llvm.org/D5798
llvm-svn: 219923
Add option ShortStatementLines to trigger this check only if the statement spans
over at least a given number of lines.
Modifications from the original patch:
merged test/clang-tidy/misc-braces-around-statements-always.cpp into
test/clang-tidy/misc-braces-around-statements.cpp and removed unnecessary
CHECK-NOTs from the tests.
http://reviews.llvm.org/D5642
Patch by Marek Kurdej!
llvm-svn: 219611
This check looks for if statements and loops: for, range-for, while and
do-while, and verifies that the inside statements are inside braces '{}'.
If not, proposes to add braces around them.
Example:
if (condition)
action();
becomes
if (condition) {
action();
}
This check ought to be used with the -format option, so that the braces be
well-formatted.
Patch by Marek Kurdej!
http://reviews.llvm.org/D5395
llvm-svn: 218898
Summary:
This patch depends on D5501.
Check user name substitution more specifically by specifying it via the new
-config= option.
This also lets clang-tidy tests specify clang-tidy options before the '--'
when using check_clang_tidy_fix.sh.
Reviewers: klimek
Reviewed By: klimek
Subscribers: curdeius, cfe-commits
Differential Revision: http://reviews.llvm.org/D5502
llvm-svn: 218515
Summary:
This uses a bit hacky way to set the defaults for the spaces before
comments, but it's also one of the simplest ways. Fixed a bug with how the
SpacesBeforeComments option was used.
Reviewers: djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5410
llvm-svn: 218240
It also suggests a fix-it, taking the name from $USER. This will be made
configurable eventually.
Differential Revision: http://reviews.llvm.org/D5393
llvm-svn: 218049
As this is very dependent on the code base it has some ways of configuration.
It's possible to pick between 3 modes of operation:
- Line counting: number of lines including whitespace and comments
- Statement counting: number of statements within compoundStmts.
- Branch counter
In addition a threshold can be picked, warnings are only emitted when it is met.
The thresholds can be configured via a .clang-tidy file.
Differential Revision: http://reviews.llvm.org/D4986
llvm-svn: 217768
Bucket replacements by FileEntry instead of path. The same file with
different paths is very common, relative #include paths and symlinks can
easily create them. When that occurs we would apply the fix twice.
llvm-svn: 217440
Summary:
This adds a support for the .clang-tidy file reading using
FileOptionsProvider, -dump-config option, and changes tests to not depend on
default checks set.
Reviewers: klimek, bkramer, djasper
Reviewed By: djasper
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5186
llvm-svn: 217155
parameter packs.
Summary:
This disables this check for std::bind and similar functions that use
parameter packs to forward arguments to a different function. Name of the
parameter pack argument doesn't matter.
Reviewers: klimek
Reviewed By: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5168
llvm-svn: 217039
Summary:
Note that this code is still grossly under-tested - the next steps will
be to add significantly better test coverage.
Patch by Matthew Plant.
Test Plan:
Reviewers:
Subscribers:
llvm-svn: 215839