summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.h
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tidy] Switch checks to #include "ClangTidyCheck.h"Alexander Kornienko2019-03-251-1/+1
| | | | llvm-svn: 356892
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Handle correctly containers that are data members in modernize-loop-convert.Angel Garcia Gomez2015-11-031-1/+1
| | | | | | | | | | | | | | | | Summary: I recently found that the variable naming wasn't working as expected with containers that are data members. The new index always received the name "Elem" (or equivalent) regardless of the container's name. The check was assuming that the container's declaration was a VarDecl, which cannot be converted to a FieldDecl (a data member), and then it could never retrieve its name. This also fixes some cases where the check failed to find the container at all (so it didn't do any fix) because of the same reason. Reviewers: klimek Subscribers: cfe-commits, alexfh Differential Revision: http://reviews.llvm.org/D14289 llvm-svn: 251943
* Only copy small types in modernize-loop-convert.Angel Garcia Gomez2015-10-301-0/+1
| | | | | | | | | | | | Summary: If the size of the type is above a certain bound, we'll take a const reference. This bound can be set as an option. For now, the default value is 16 bytes. Reviewers: klimek Subscribers: alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D14176 llvm-svn: 251694
* Don't use "auto" on loops over fundamental types in modernize-loop-convert.Angel Garcia Gomez2015-10-221-1/+1
| | | | | | | | | | | | Summary: using "auto" on a loop that iterates over ints is kind of an overkill. Use the real type name instead. Reviewers: klimek Subscribers: alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D13982 llvm-svn: 251015
* Prevent loop-convert from leaving empty lines after removing an alias ↵Angel Garcia Gomez2015-10-011-0/+2
| | | | | | | | | | | | | | declaration. Summary: This fixes https://llvm.org/bugs/show_bug.cgi?id=17716. Reviewers: klimek Subscribers: cfe-commits, alexfh Differential Revision: http://reviews.llvm.org/D13342 llvm-svn: 249006
* Add NamingStyle option to modernize-loop-convert.Angel Garcia Gomez2015-09-241-1/+2
| | | | | | | | | | | | 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
* Refactor LoopConvertCheck.Angel Garcia Gomez2015-09-211-12/+29
| | | | | | | | | | | | 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
* Another patch for modernize-loop-convert.Angel Garcia Gomez2015-09-111-1/+1
| | | | | | | | | | | | | | | | | | Summary: 1. Avoid converting loops that iterate over the size of a container and don't use its elements, as this would result in an unused-result warning. 2. Never capture the elements by value on lambdas, thus avoiding doing unnecessary copies and errors with non-copyable types. 3. The 'const auto &' instead of 'auto &' substitution on const containers now works on arrays and pseudoarrays as well. 4. The error about multiple replacements in the same macro call is now documented in the tests (not solved though). 5. Due to [1], I had to add a dummy usage of the range element (like "(void) *It;" or similars) on the tests that had empty loops. 6. I removed the braces from the CHECK comments. I think that there is no need for them, and they confuse vim. Reviewers: klimek Subscribers: alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D12734 llvm-svn: 247399
* Avoid using rvalue references with trivially copyable types.Angel Garcia Gomez2015-09-081-6/+11
| | | | | | | | | | | | | | | | Summary: When the dereference operator returns a value that is trivially copyable (like a pointer), copy it. After this change, modernize-loop-convert check can be applied to the whole llvm source code without breaking any build or test. Reviewers: alexfh, klimek Subscribers: alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D12675 llvm-svn: 246989
* [clang-tidy] Add loop-convert check to clang-tidy.Alexander Kornienko2015-08-191-0/+52
Move LoopConvert from clang-modernize to modernize module in clang-tidy. http://reviews.llvm.org/D12076 Patch by Angel Garcia! llvm-svn: 245427
OpenPOWER on IntegriCloud