summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/performance/InefficientVectorOperationCheck.h
Commit message (Collapse)AuthorAgeFilesLines
* [clang-tidy] performance-inefficient-vector-operation: Support proto ↵Haojian Wu2019-09-161-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* [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
* [clang-tidy] Support detecting for-range loop in ↵Haojian Wu2017-04-261-2/+5
| | | | | | | | | | | | | | | | | | 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
* [clang-tidy] Add a clang-tidy check for possible inefficient vector operationsHaojian Wu2017-04-181-0/+36
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