summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/performance-inefficient-vector-operation.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [ClangTidy] Separate tests for infrastructure and checkersDmitri Gribenko2019-10-111-361/+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
* [clang-tidy] performance-inefficient-vector-operation: Support proto ↵Haojian Wu2019-09-161-2/+86
| | | | | | | | | | | | | | | | | | | | | | | | | repeated field Summary: Finds calls that add element to protobuf repeated field in a loop without calling Reserve() before the loop. Calling Reserve() first can avoid unnecessary memory reallocations. A new option EnableProto is added to guard this feature. Patch by Cong Liu! Reviewers: gribozavr, alexfh, hokein, aaron.ballman Reviewed By: hokein Subscribers: lebedev.ri, xazax.hun, Eugene.Zelenko, cfe-commits Tags: #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D67135 llvm-svn: 371963
* 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] Add "emplace_back" detection in inefficient-vector-operation.Haojian Wu2017-05-161-84/+96
| | | | | | | | | | | | | | Reviewers: alexfh, aaron.ballman Reviewed By: alexfh Subscribers: cfe-commits, Prazek, malcolm.parsons, xazax.hun Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D33209 llvm-svn: 303157
* [clang-tidy] Support detecting for-range loop in ↵Haojian Wu2017-04-261-2/+83
| | | | | | | | | | | | | | | | | | inefficient-vector-operation check. Summary: Also add an option "VectorLikeClasses" allowing user specify customized vectors. Reviewers: alexfh, aaron.ballman Reviewed By: alexfh Subscribers: Eugene.Zelenko, cfe-commits Differential Revision: https://reviews.llvm.org/D32436 llvm-svn: 301440
* Make the test pass on x86_64-win32 target.Haojian Wu2017-04-181-8/+8
| | | | llvm-svn: 300563
* clang-tools-extra/test/clang-tidy/performance-inefficient-vector-operation.c ↵NAKAMURA Takumi2017-04-181-1/+2
| | | | | | | pp: Appease targeting msvc with -fno-ms-extensions. FIXME: This may work with -target x86_64-win32. llvm-svn: 300545
* [clang-tidy] Add a clang-tidy check for possible inefficient vector operationsHaojian Wu2017-04-181-0/+183
Summary: The "performance-inefficient-vector-operation" check finds vector oprations in for-loop statements which may cause multiple memory reallocations. This is the first version, only detects typical for-loop: ``` std::vector<int> v; for (int i = 0; i < n; ++i) { v.push_back(i); } // or for (int i = 0; i < v2.size(); ++i) { v.push_back(v2[i]); } ``` We can extend it to handle more cases like for-range loop in the future. Reviewers: alexfh, aaron.ballman Reviewed By: aaron.ballman Subscribers: zaks.anna, Eugene.Zelenko, mgorny, cfe-commits, djasper Differential Revision: https://reviews.llvm.org/D31757 llvm-svn: 300534
OpenPOWER on IntegriCloud