Summary:
clang-tidy should fix identifier naming even when the identifier is
referenced inside a macro expansion, provided that the identifier enters
the macro expansion completely within a macro argument.
For example, this will allow fixes to the naming of the identifier
'global' when it is declared and used as follows:
int global;
#define USE_IN_MACRO(m) auto use_##m = m
USE_IN_MACRO(global);
Reviewers: alexfh
Subscribers: jlebar, cfe-commits
Differential Revision: https://reviews.llvm.org/D25450
llvm-svn: 284992
Summary:
This doesn't work after converting SmallSetVector to use DenseSet.
Instead we can just use a SmallVector.
Reviewers: timshen
Subscribers: nemanjai, cfe-commits
Differential Revision: https://reviews.llvm.org/D25647
llvm-svn: 284873
Summary: The check emits a warning if a member-initializer calls the member's default constructor with no arguments.
Reviewers: sbenza, alexfh, aaron.ballman
Subscribers: modocache, mgorny, Eugene.Zelenko, etienneb, Prazek, hokein, cfe-commits, beanz
Differential Revision: https://reviews.llvm.org/D24339
llvm-svn: 284742
Summary:
clang-tidy now cleans up after replacements, so leave colon and comma
removal to that.
Reviewers: angelgarcia, alexfh, aaron.ballman, djasper, ioeric
Subscribers: djasper, cfe-commits
Differential Revision: https://reviews.llvm.org/D25769
llvm-svn: 284735
Summary:
The matcher for matching "class with default constructor" still match
some classes without default constructor, which trigger an assert at
Line 307. This patch makes the matcher more strict.
Reviewers: aaron.ballman
Subscribers: nemanjai, cfe-commits
Differential Revision: https://reviews.llvm.org/D25747
llvm-svn: 284727
Hello, i would like to suggest a fix for one of the checks in clang-tidy and i should hope this one is the correct mailing list.
The check is modernize-avoid-bind.
Consider the following:
void bar(int x, int y);
namespace N {
void bar(int x, int y);
}
void foo(){
auto Test = std::bind(N::bar,1,1);
}
clang-tidy’s modernize-avoid-bind check suggests writing:
void foo(){
auto Test =[] {return bar(1,1);};
}
instead of:
void foo(){
auto Test = [] {return N::bar(1,1);};
}
So clang-tidy has proposed an incorrect Fix.
Patch by IdrissRio!
Reviewers: alexfh, hokein, aaron.ballman
Subscriber: cfe-commits
llvm-svn: 284719
Summary: This adds cert-err09-cpp alias for completeness, similar to cert-err61-cpp.
Reviewers: alexfh, hokein
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25770
llvm-svn: 284596
Summary:
Remove empty namespaces and initializer list commas / colons in
affected ranges. Initial patch: proper options for enabling the cleanup and
specifying the format style are needed.
Reviewers: hokein, ioeric
Subscribers: beanz, mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D24572
llvm-svn: 284399
The filepath might contain some characters (i.e. '@') which are not
illegal in c identifiers. This patch changes all non-alphanumeric characters
to '_'.
llvm-svn: 284391
Summary: This adds helper classes to add using declaractions and namespace aliases to function bodies. These help making function calls to deeply nested functions concise (e.g. when calling helpers in a refactoring)
Patch by Julian Bangert!
Reviewers: alexfh, hokein
Subscribers: beanz, mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D24997
llvm-svn: 284368
clang-tools-extra\unittests\clang-move\ClangMoveTests.cpp(216) : error C2593: 'operator =' is ambiguous
llvm\include\llvm/ADT/SmallVector.h(898): could be 'const llvm::SmallVector<std::string,4> &llvm::SmallVector<std::string,4>::operator =(std::initializer_list<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>)'
llvm\include\llvm/ADT/SmallVector.h(893): or 'const llvm::SmallVector<std::string,4> &llvm::SmallVector<std::string,4>::operator =(llvm::SmallVectorImpl<T> &&)'
with
[
T=std::string
]
llvm\include\llvm/ADT/SmallVector.h(883): or 'const llvm::SmallVector<std::string,4> &llvm::SmallVector<std::string,4>::operator =(llvm::SmallVector<std::string,4> &&)'
llvm\include\llvm/ADT/SmallVector.h(873): or 'const llvm::SmallVector<std::string,4> &llvm::SmallVector<std::string,4>::operator =(const llvm::SmallVector<std::string,4> &)'
while trying to match the argument list '(llvm::SmallVector<std::string,4>, initializer-list)'
llvm-svn: 284360
This diff replaces manual parsing of the comma-separated list of names with
cl::list and cl::CommaSeparated.
Test plan: make -j8 check-clang-tools
Differential revision: https://reviews.llvm.org/D25586
llvm-svn: 284291
Summary:
This adds a diagnostic to the misc-use-after-move check that is output when the
use happens on a later loop iteration than the move, for example:
A a;
for (int i = 0; i < 10; ++i) {
a.foo();
std::move(a);
}
This situation can be confusing to users because, in terms of source code
location, the use is above the move. This can make it look as if the warning
is a false positive, particularly if the loop is long but the use and move are
close together.
In cases like these, misc-use-after-move will now output an additional
diagnostic:
a.cpp:393:7: note: the use happens in a later loop iteration than the move
Reviewers: hokein
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25612
llvm-svn: 284235
Summary:
The header guard generated by clang-move isn't always a perfect
style, just avoid getting the header included multiple times during
compiling period.
Also, we can use llvm-Header-guard clang-tidy check to correct the guard
automatically.
Reviewers: ioeric
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25610
llvm-svn: 284233
Summary:
This fixes a false-positive e.g. when string literals are returned from if statement.
This patch includes as well a small fix to includes and renames of the test suite that collided with the name of the check.
Reviewers: alexfh, hokein
Subscribers: hokein
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D25558
llvm-svn: 284212
Summary:
* When moving an outermost enclosing class, all its nested classes should also
be moved together.
* Add a test for not moving nested class.
Reviewers: ioeric
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25369
llvm-svn: 284111
Summary: MakeAbsolutePath does wrong things with symlinks previously. When comparing with a symlink, we need to compare with the real path of it. This fixes issues when the build directory is a symlink.
Reviewers: ioeric
Subscribers: beanz, mgorny, cfe-commits, bkramer
Differential Revision: https://reviews.llvm.org/D25508
llvm-svn: 284020
Summary: This adds helper classes to add using declaractions and namespace aliases to function bodies. These help making function calls to deeply nested functions concise (e.g. when calling helpers in a refactoring)
Patch by Julian Bangert!
Reviewers: alexfh, hokein
Subscribers: cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D24997
llvm-svn: 283981
Summary:
* Fix a false postive when an using class is used in an explicit template instantiation.
* Fix a false postive when an using template class is used as template argument.
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D25437
llvm-svn: 283879
Summary:
Only member initializers that are written should prevent
using '= default' on a default constructor.
Reviewers: klimek, sbenza, aaron.ballman, alexfh
Subscribers: Eugene.Zelenko, alexfh, klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D24444
llvm-svn: 283869
By default, Emacs prompts the user when killing processes on exit. This is useful for stateful processes such as interactive shells. However, clang-include-fixer processes are stateless; the only effect of killing them is to cancel a clang-include-fixer operation. Therefore prompting the user is just a nuisance.
Patch by Philipp Stephani.
Differential Revision: https://reviews.llvm.org/D25378
llvm-svn: 283863