summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/performance-for-range-copy.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [ClangTidy] Separate tests for infrastructure and checkersDmitri Gribenko2019-10-111-272/+0
| | | | | | | | | | | | | | | | | | | | Summary: This change moves tests for checkers and infrastructure into separate directories, making it easier to find infrastructure tests. Tests for checkers are already easy to find because they are named after the checker. Tests for infrastructure were difficult to find because they were outnumbered by tests for checkers. Now they are in a separate directory. Reviewers: jfb, jdoerfert, lebedev.ri Subscribers: srhines, nemanjai, aheejin, kbarton, christof, mgrang, arphaman, jfb, lebedev.ri, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68807 llvm-svn: 374540
* Run ClangTidy tests in all C++ language modesDmitri Gribenko2019-05-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: I inspected every test and did one of the following: - changed the test to run in all language modes, - added a comment explaining why the test is only applicable in a certain mode, - limited the test to language modes where it passes and added a FIXME to fix the checker or the test. Reviewers: alexfh, lebedev.ri Subscribers: nemanjai, kbarton, arphaman, jdoerfert, lebedev.ri, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62125 llvm-svn: 361131
* [clang-tidy] Fix tests for performance-for-range-copyShuai Wang2018-09-171-0/+5
| | | | | | | | | | | | | | | | | | | | Test failed as D52120 made ExprMutationAnalyzer smarter, fixed by: - Add move-ctor for `Mutable` to make it actually movable. - Properly implement `remove_reference`. The failed test case is: void negativeVarIsMoved() { for (auto M : View<Iterator<Mutable>>()) { auto Moved = std::move(M); } } Before D52120, `std::move(M)` itself is considered as a mutation to `M`, while after D52120 it's only considered as a cast to rvalue, the move-assignment is what causes the actual mutation. The test case didn't mock things properly so the intended move-assignement was actually a copy-assignment. llvm-svn: 342417
* [clang-tidy] Omit cases where loop variable is not used in loop body inHaojian Wu2018-08-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | performance-for-range-copy check. Summary: The upstream change r336737 make the check too smart to fix the case where loop variable could be used as `const auto&`. But for the case below, changing to `const auto _` will introduce an unused complier warning. ``` for (auto _ : state) { // no references for _. } ``` This patch omit this case, and it is safe to do it as the case is very rare. Reviewers: ilya-biryukov, alexfh Subscribers: xazax.hun, cfe-commits Differential Revision: https://reviews.llvm.org/D50447 llvm-svn: 339415
* Use ExprMutationAnalyzer in performance-for-range-copyShuai Wang2018-07-101-0/+14
| | | | | | | | | | | | | | | | | | | | | Summary: This gives better coverage to the check as ExprMutationAnalyzer is more accurate comparing to isOnlyUsedAsConst. Majority of wins come from const usage of member field, e.g.: for (auto widget : container) { // copy of loop variable if (widget.type == BUTTON) { // const usage only recognized by ExprMutationAnalyzer // ... } } Reviewers: george.karpenkov Subscribers: a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D48854 llvm-svn: 336737
* [clang-tidy] Only invoke ForRangeCopyCheck on expensive-to-copy types.Felix Berger2016-02-151-0/+25
| | | | | | | | | | | | | | Summary: Fix oversight not checking the value of the Optional<bool> returned by isExpensiveToCopy(). Reviewers: alexfh Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D17064 llvm-svn: 260870
* test/clang-tidy/performance-for-range-copy.cpp: Appease for targeting ms mode.NAKAMURA Takumi2016-01-301-1/+1
| | | | llvm-svn: 259289
* [clang-tidy] ForRangeCopyCheck that warns on and fixes unnecessary copies of ↵Alexander Kornienko2016-01-291-0/+223
loop variables. Patch by Felix Berger! Differential revision: http://reviews.llvm.org/D13849 llvm-svn: 259199
OpenPOWER on IntegriCloud