summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/modernize
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix loop-convert for const references to containers.Manuel Klimek2015-09-231-0/+6
| | | | | | | | | | | | 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
* Refactor LoopConvertCheck.Angel Garcia Gomez2015-09-212-224/+274
| | | | | | | | | | | | 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
* Refactors AST matching code to use the new AST matcher names. This patch ↵Aaron Ballman2015-09-176-48/+51
| | | | | | correlates to r247885 which performs the AST matcher rename in Clang. llvm-svn: 247886
* Another patch for modernize-loop-convert.Angel Garcia Gomez2015-09-114-12/+80
| | | | | | | | | | | | | | | | | | 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
* [clang-tidy] Updated docs.Alexander Kornienko2015-09-081-6/+8
| | | | llvm-svn: 246996
* Avoid using rvalue references with trivially copyable types.Angel Garcia Gomez2015-09-083-40/+63
| | | | | | | | | | | | | | | | 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
* Avoid repeated replacements on loop-convert check.Angel Garcia Gomez2015-09-042-9/+22
| | | | | | | | | | | | Summary: The InitListExpr subtree is visited twice, this caused the check to do multiple replacements. Added a set to avoid it. Reviewers: klimek, alexfh Subscribers: cfe-commits, alexfh Differential Revision: http://reviews.llvm.org/D12631 llvm-svn: 246879
* Two more fixes to loop convert.Angel Garcia Gomez2015-09-032-2/+49
| | | | | | | | | | | | Summary: Ensure that the alias has the same type than the loop variable. Now it works with lambda captures. Reviewers: klimek Subscribers: alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D12597 llvm-svn: 246762
* Fix loop-convert crash.Angel Garcia Gomez2015-09-021-1/+4
| | | | | | | | | | | | Summary: loop-convert no longer crashes when calling a member function using a member pointer which is a member of another record. Reviewers: alexfh, klimek Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D12555 llvm-svn: 246655
* Fix use-auto-check.Angel Garcia Gomez2015-09-021-1/+1
| | | | | | | | | | | | Summary: Fix a bug where use-auto check would crash when the definition of a type is in the same statement than its instantiation with new. Reviewers: alexfh Subscribers: cfe-commits, klimek Differential Revision: http://reviews.llvm.org/D12551 llvm-svn: 246638
* Fix several corner cases for loop-convert check.Angel Garcia Gomez2015-09-013-17/+48
| | | | | | | | | | | | Summary: Reduced the amount of wrong conversions of this check. Reviewers: klimek Subscribers: alexfh, cfe-commits Differential Revision: http://reviews.llvm.org/D12530 llvm-svn: 246550
* [clang-tidy] Move misc-use-override and readability-shrink-to-fit to ↵Alexander Kornienko2015-08-316-0/+376
| | | | | | | | | "modernize/" These checks are focusing on migrating the code from C++98/03 to C++11, so they belong to the modernize module. llvm-svn: 246437
* Disable several more clang-tidy modernize checkers when not compiling in C++ ↵Aaron Ballman2015-08-284-37/+66
| | | | | | mode. Loop conversion would make recommendations for C code, so added a test to ensure that does not happen. The pass by value, use auto and replace auto_ptr checkers would not make recommendations for C code, and are disabled for performance reasons, but do not require an extra test. llvm-svn: 246310
* Reapplying r246209, which exposed language options to the checkers. This ↵Aaron Ballman2015-08-281-1/+5
| | | | | | time disable UseNullptrCheck when not compiling in C++ mode, but still allow in C++11 mode since it's likely the user wishes to modernize their code. llvm-svn: 246298
* Reverting r246209 while I investigate a build bot failure: ↵Aaron Ballman2015-08-271-3/+1
| | | | | | http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/30516 llvm-svn: 246224
* Expose language options to the checkers; disable UseNullptrCheck when not ↵Aaron Ballman2015-08-271-1/+3
| | | | | | compiling in C++11 mode. llvm-svn: 246209
* Fix another LoopConvert fail.Angel Garcia Gomez2015-08-261-2/+8
| | | | | | | | | | | | Summary: Prevent LoopConvert from taking as alias anything that comes from a random member function call. Reviewers: alexfh Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D12370 llvm-svn: 246039
* LoopConvert no longer take as alias references to other containers.Angel Garcia Gomez2015-08-261-1/+1
| | | | | | | | | | | | Summary: Fix a bug where modernize-loop-convert check would take as alias a reference to other containers. Add the pertinent test. Reviewers: alexfh Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D12361 llvm-svn: 246034
* Avoid LoopConvertCheck replacements in template instantiations.Angel Garcia Gomez2015-08-251-0/+3
| | | | | | | | | | | | Summary: Prevent LoopConvertCheck from doing replacements in template instantiations, and add a test. Reviewers: alexfh Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D12321 llvm-svn: 245942
* Add replace-auto_ptr check.Angel Garcia Gomez2015-08-254-0/+326
| | | | | | | | | | | | Summary: Migrate replace-auto_ptr check from clang-modernize to modernize module in clang-tidy. Reviewers: alexfh Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D12287 llvm-svn: 245933
* [clang-tidy] Migrate UseAuto from clang-modernize to clang-tidy.Angel Garcia Gomez2015-08-214-0/+407
| | | | | | http://reviews.llvm.org/D12231 llvm-svn: 245703
* Test commit!Angel Garcia Gomez2015-08-211-0/+1
| | | | llvm-svn: 245701
* [clang-tidy] Fix bug in modernize-loop-convert check.Alexander Kornienko2015-08-201-2/+3
| | | | | | | | http://reviews.llvm.org/D12186 Patch by Angel Garcia! llvm-svn: 245561
* [clang-tidy] Fold the meat of the UseNullPtrCheck into an anonymous namespace.Benjamin Kramer2015-08-201-0/+2
| | | | | | | | While convenient, RecursiveASTVisitor generates a ridiculous amount of dead template code. Making it not visible from the outside lets the compiler eliminate some of it, shrinking clang-tidy by ~140k. llvm-svn: 245548
* [clang-tidy] Add back a test with a custom NULL macro. Remove redundant default.Alexander Kornienko2015-08-201-1/+1
| | | | llvm-svn: 245533
* [clang-tidy] Fix use-after-free in UseNullptrCheck.Alexander Kornienko2015-08-192-6/+5
| | | | llvm-svn: 245524
* [clang-tidy] Work around failure in Darwin.Alexander Kornienko2015-08-191-1/+1
| | | | llvm-svn: 245517
* [clang-tidy] Add modernize-use-nullptr check, attempt 2.Alexander Kornienko2015-08-194-0/+511
| | | | | | | | | | | This patch re-applies r245434 and r245471 reverted in r245493, and changes the way custom null macros are configured. The test for custom null macros is temporarily excluded and will be committed separately to reduce chances of breakages. Initial patches by Angel Garcia. llvm-svn: 245511
* Revert "[clang-tidy] Add use-nullptr check to clang-tidy."Justin Bogner2015-08-194-512/+0
| | | | | | | | | | The new test is failing on darwin: http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/10339/ This reverts r245434 and its follow up r245471. llvm-svn: 245493
* Replacing a custom AST matcher with some builtin AST matchers; NFC, and ↵Aaron Ballman2015-08-191-14/+1
| | | | | | existing tests should provide sufficient coverage. llvm-svn: 245492
* [clang-tidy] Fix a bug in UseNullptrCheck.Alexander Kornienko2015-08-191-3/+3
| | | | | | | | http://reviews.llvm.org/D12162 Patch by Angel Garcia! llvm-svn: 245471
* [clang-tidy] Fix LoopConvertCheck bug.Alexander Kornienko2015-08-191-6/+4
| | | | | | | | | | | | Fix LoopConvertCheck bug: StringRef to temporaries. Also add LLVM_ATTRIBUTE_UNUSED to ModernizeModuleAnchorDestination. http://reviews.llvm.org/D12157 Patch by Angel Garcia! llvm-svn: 245458
* [clang-tidy] Add use-nullptr check to clang-tidy.Alexander Kornienko2015-08-194-0/+512
| | | | | | | | | | Move UseNullptr from clang-modernize to modernize module in clang-tidy. http://reviews.llvm.org/D12081 Patch by Angel Garcia! llvm-svn: 245434
* [clang-tidy] Add loop-convert check to clang-tidy.Alexander Kornienko2015-08-196-0/+1962
| | | | | | | | | | Move LoopConvert from clang-modernize to modernize module in clang-tidy. http://reviews.llvm.org/D12076 Patch by Angel Garcia! llvm-svn: 245427
* clangTidyModernizeModule: Update libdeps.NAKAMURA Takumi2015-08-151-0/+1
| | | | llvm-svn: 245144
* [clang-tidy] Move IncludeSorter.* and IncludeInserter.* to clang-tidy/utils/Alexander Kornienko2015-08-141-1/+1
| | | | | | | This is better structurally and it also fixes a linker error in the configure build. llvm-svn: 245052
* [clang-tidy] Create clang-tidy module modernize. Add pass-by-value check.Alexander Kornienko2015-08-145-0/+334
This is the first step for migrating cppmodernize to clang-tidy. http://reviews.llvm.org/D11946 Patch by Angel Garcia! llvm-svn: 245045
OpenPOWER on IntegriCloud