llvm-project/clang-tools-extra/docs/clang-tidy
Haojian Wu c5cc03377e [clang-tidy] Add a clang-tidy check for possible inefficient vector operations
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
2017-04-18 07:46:39 +00:00
..
checks [clang-tidy] Add a clang-tidy check for possible inefficient vector operations 2017-04-18 07:46:39 +00:00
tools [clang-tidy] Python scripts shebang fixes 2016-01-19 16:10:39 +00:00
index.rst [clang-tidy] Update docs and help message 2017-04-06 14:27:00 +00:00