Before this check, I would get the following error:
Updating ./misc/CMakeLists.txt...
Creating ./misc/NoReinterpret_castCheck.h...
Creating ./misc/NoReinterpret_castCheck.cpp...
Updating ./misc/MiscTidyModule.cpp...
Creating ../test/clang-tidy/misc-no-reinterpret_cast.cpp...
Creating ../docs/clang-tidy/checks/misc-no-reinterpret_cast.rst...
Traceback (most recent call last):
File "./add_new_check.py", line 271, in <module>
main()
File "./add_new_check.py", line 267, in main
update_checks_list(module_path)
File "./add_new_check.py", line 220, in update_checks_list
os.listdir('docs/clang-tidy/checks')))
OSError: [Errno 2] No such file or directory: 'docs/clang-tidy/checks'
Patch by Matthias Gehre!
Differential revision: http://reviews.llvm.org/D13272
llvm-svn: 248997
This diff requires http://reviews.llvm.org/D13079 to be applied first. I wasn't sure about how to make patch series in Phabricator, and I wanted to keep the two separate for clarity.
It looks like that most cases can be supported with this patch. I'm not totally sure about the actual coverage though. I think that the matchers are very generic, but I'm still not totally fluent with the AST.
Patch by Beren Minor!
Differential revision: http://reviews.llvm.org/D13081
llvm-svn: 248996
Summary:
This fixes https://llvm.org/bugs/show_bug.cgi?id=22196 .
Also add a non-trivially copyable type to fix some tests that were meant to be about using const-refs, but were changed in r248438.
Reviewers: klimek
Subscribers: alexfh, cfe-commits
Differential Revision: http://reviews.llvm.org/D13292
llvm-svn: 248994
Summary: create a check that replaces 'std::unique_ptr<type>(new type(args...))' with 'std::make_unique<type>(args...)'. It was on the list of "Ideas for new Tools". It needs to be tested more carefully, but first I wanted to know if you think it is worth the effort.
Reviewers: klimek
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D13166
llvm-svn: 248785
Summary:
compile_commands.json is usually generated in the build directory.
Projects like LLVM/Clang enforce out-of-source builds.
This option allow allow such projects to work out of the box, without
moving the compilation database manually.
The naming of the option is similar to the one use by other tools:
clang-{check,modernize,query,rename,tidy} -p=<build_path> <...>
Reviewers: alexfh
Differential Revision: http://reviews.llvm.org/D13199
llvm-svn: 248723
This is to level the ground a little bit, in preparation for the changes in http://reviews.llvm.org/D13081.
Code factorization replaces all insertions to NamingCheckFailures map with a unique addUsage function that does the job.
There is also no more difference between the declaration and the references to a given identifier, both cases are treated as ranges in the Usage vector. There is also a check to avoid duplicated ranges to be inserted, which sometimes triggered erroneous replacements.
References can now also be added before the declaration of the identifier is actually found; this looks to be the case for example when a templated class uses its parameters to specialize its templated base class.
Patch by Beren Minor!
Differential revision: http://reviews.llvm.org/D13079
llvm-svn: 248700
Summary: Add an option to specify wich style must be followed when choosing the new index name.
Reviewers: alexfh
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D13052
llvm-svn: 248517
Previously, we would rewrite:
void f(const vector<int> &v) {
for (size_t i = 0; i < v.size(); ++i) {
to
for (const auto &elem : v) {
Now we rewrite it to:
for (auto elem : v) {
(and similarly for iterator based loops).
llvm-svn: 248438
Previously we would use a non-const loop variable in the range-based
loop for:
void f(const std::vector<int> &v) {
for (size_t i = 0; i < v.size(); ++i) {
Now we use const auto&.
Note that we'll also want to use a copy at least for simple types.
llvm-svn: 248418
Summary: Replace references to "transform" with references to "check" where neccessary in the documentation.
Reviewers: alexfh
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D13006
llvm-svn: 248153
Summary: Reorder the code in a more logical and understandable way.
Reviewers: klimek
Subscribers: cfe-commits, alexfh
Differential Revision: http://reviews.llvm.org/D12797
llvm-svn: 248144
Scripts are installed in same location as clang-fromat ones, so I think will be good idea to not create dedicated directory.
I checked this patch on my own build on RHEL 6.
Please check it in if it's OK, because I don't have SVN write access.
I think will be good idea to backport this patch to 3.7 release branch.
Probably same should be done for configure build.
Patch by Eugene Zelenko!
Differential revision: http://reviews.llvm.org/D12700
llvm-svn: 247890
Summary: Add the test about replacements in several arguments of the same macro call, now that the problem has been fixed.
Reviewers: alexfh
Subscribers: cfe-commits, klimek
Differential Revision: http://reviews.llvm.org/D12933
llvm-svn: 247889