diff options
author | Haojian Wu <hokein@google.com> | 2017-04-18 07:46:39 +0000 |
---|---|---|
committer | Haojian Wu <hokein@google.com> | 2017-04-18 07:46:39 +0000 |
commit | c5cc03377e10929be9490085cd1896107889f9c2 (patch) | |
tree | 77b4b8250f963611539f0ed887ec4d3339fc2adb /clang/lib/Sema/SemaAttr.cpp | |
parent | 74619721a9a22c5387fbd6f435492667d7373fda (diff) | |
download | bcm5719-llvm-c5cc03377e10929be9490085cd1896107889f9c2.tar.gz bcm5719-llvm-c5cc03377e10929be9490085cd1896107889f9c2.zip |
[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
Diffstat (limited to 'clang/lib/Sema/SemaAttr.cpp')
0 files changed, 0 insertions, 0 deletions