github-actions[bot] wrote:
<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results
* 3042 tests passed
* 29 tests skipped
* 1 test failed
## Failed Tests
(click on a test name to see its output)
### Clang Tools
<details>
<summary>Clang
Tools.clang-tidy/checkers/performance/inefficient-vector-operation.cpp</summary>
```
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
C:/Python312/python.exe
C:/_work/llvm-project/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py
C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\performance\inefficient-vector-operation.cpp
performance-inefficient-vector-operation
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp
-- -format-style=llvm -config='{CheckOptions:
{performance-inefficient-vector-operation.EnableProto: true}}'
# executed command: C:/Python312/python.exe
'C:/_work/llvm-project/llvm-project/clang-tools-extra/test/../test\clang-tidy\check_clang_tidy.py'
'C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\performance\inefficient-vector-operation.cpp'
performance-inefficient-vector-operation
'C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp'
-- -format-style=llvm '-config={CheckOptions:
{performance-inefficient-vector-operation.EnableProto: true}}'
# .---command stdout------------
# | Running ['clang-tidy', '--experimental-custom-checks',
'C:\\_work\\llvm-project\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\performance\\Output\\inefficient-vector-operation.cpp.tmp.cpp',
'-fix', '--checks=-*,performance-inefficient-vector-operation',
'-format-style=llvm', '-config={CheckOptions:
{performance-inefficient-vector-operation.EnableProto: true}}', '--',
'-std=c++11', '-nostdinc++']...
# | ------------------------ clang-tidy output -----------------------
# | 22 warnings generated.
# |
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:97:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 96 | for (int i = 0; i < 10; ++i)
# | 97 | v0.push_back(i);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:96:5:
note: FIX-IT applied suggested code changes
# | 96 | for (int i = 0; i < 10; ++i)
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:104:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 103 | for (int i = 0; i < 10; i++)
# | 104 | v1.push_back(i);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:103:5:
note: FIX-IT applied suggested code changes
# | 103 | for (int i = 0; i < 10; i++)
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:111:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 110 | for (int i = 0; i < 10; ++i)
# | 111 | v2.push_back(0);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:110:5:
note: FIX-IT applied suggested code changes
# | 110 | for (int i = 0; i < 10; ++i)
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:118:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 117 | for (int i = 0; i < 5; ++i) {
# | 118 | v3.push_back(i);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:117:5:
note: FIX-IT applied suggested code changes
# | 117 | for (int i = 0; i < 5; ++i) {
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:133:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 132 | for (int i = 0; i < 10; ++i)
# | 133 | v4.push_back(i);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:132:5:
note: FIX-IT applied suggested code changes
# | 132 | for (int i = 0; i < 10; ++i)
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:140:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 139 | for (std::size_t i = 0; i < t.size(); ++i) {
# | 140 | v6.push_back(t[i]);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:139:5:
note: FIX-IT applied suggested code changes
# | 139 | for (std::size_t i = 0; i < t.size(); ++i) {
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:148:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 147 | for (std::size_t i = 0; i < t.size() - 1; ++i) {
# | 148 | v7.push_back(t[i]);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:147:5:
note: FIX-IT applied suggested code changes
# | 147 | for (std::size_t i = 0; i < t.size() - 1; ++i) {
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:155:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 154 | for (const auto &e : t) {
# | 155 | v8.push_back(e);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:154:5:
note: FIX-IT applied suggested code changes
# | 154 | for (const auto &e : t) {
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:163:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 162 | for (const auto &e : t) {
# | 163 | v9.push_back(Op(e));
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:162:5:
note: FIX-IT applied suggested code changes
# | 162 | for (const auto &e : t) {
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:171:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 170 | for (const auto &e : t) {
# | 171 | v10.push_back(Foo(e));
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:170:5:
note: FIX-IT applied suggested code changes
# | 170 | for (const auto &e : t) {
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:179:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 178 | for (const auto &e : t) {
# | 179 | v11.push_back(e);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:178:5:
note: FIX-IT applied suggested code changes
# | 178 | for (const auto &e : t) {
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:187:7:
warning: 'emplace_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 186 | for (const auto &e : t) {
# | 187 | v12.emplace_back(e);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:186:5:
note: FIX-IT applied suggested code changes
# | 186 | for (const auto &e : t) {
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:196:7:
warning: 'add_x' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 195 | for (int i = 0; i < 5; i++) {
# | 196 | foo.add_x(i);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:195:5:
note: FIX-IT applied suggested code changes
# | 195 | for (int i = 0; i < 5; i++) {
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:326:7:
warning: 'add_x' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 325 | for (int i = 0; i < 5; i++) {
# | 326 | foo.add_x(i);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:325:5:
note: FIX-IT applied suggested code changes
# | 325 | for (int i = 0; i < 5; i++) {
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:344:7:
warning: 'add_x' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 343 | for (int i = 0; i < 5; i++) {
# | 344 | foo.add_x();
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:343:5:
note: FIX-IT applied suggested code changes
# | 343 | for (int i = 0; i < 5; i++) {
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:371:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 370 | for (auto Number : Numbers) {
# | 371 | Result.push_back(Number);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:370:5:
note: FIX-IT applied suggested code changes
# | 370 | for (auto Number : Numbers) {
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:384:5:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 383 | for (auto Number : Src.Numbers) {
# | 384 | A.push_back(Number);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:383:3:
note: FIX-IT applied suggested code changes
# | 383 | for (auto Number : Src.Numbers) {
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:400:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 399 | for (unsigned i = 0; i < 10; ++i)
# | 400 | gh95596_0.push_back(i);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:399:5:
note: FIX-IT applied suggested code changes
# | 399 | for (unsigned i = 0; i < 10; ++i)
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:407:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 406 | for (int i = 0U; i < 10; ++i)
# | 407 | gh95596_1.push_back(i);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:406:5:
note: FIX-IT applied suggested code changes
# | 406 | for (int i = 0U; i < 10; ++i)
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:414:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 413 | for (unsigned i = 0U; i < 10; ++i)
# | 414 | gh95596_2.push_back(i);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:413:5:
note: FIX-IT applied suggested code changes
# | 413 | for (unsigned i = 0U; i < 10; ++i)
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:421:7:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 420 | for (int i = 0; i < 10U; ++i)
# | 421 | gh95596_3.push_back(i);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:420:5:
note: FIX-IT applied suggested code changes
# | 420 | for (int i = 0; i < 10U; ++i)
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:434:5:
warning: 'push_back' is called inside a loop; consider pre-allocating the
container capacity before the loop [performance-inefficient-vector-operation]
# | 433 | for (int i = 0; i < 10; ++i) {
# | 434 | v1.push_back(i);
# | | ^
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:433:3:
note: FIX-IT applied suggested code changes
# | clang-tidy applied 22 of 22 suggested fixes.
# |
# | 433 | for (int i = 0; i < 10; ++i) {
# | | ^
# |
# | ------------------------------------------------------------------
# | diff -u
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.orig
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp
failed:
# | ---
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.orig
2026-02-03 16:01:54.266825100 +0000
# | +++
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp
2026-02-03 16:01:54.383451000 +0000
# | @@ -93,6 +93,7 @@
# | {
# |
# | std::vector<int> v0;
# |
# | //
# |
# | + v0.reserve(10);
# |
# | for (int i = 0; i < 10; ++i)
# |
# | v0.push_back(i);
# |
# | //
# |
# | @@ -100,6 +101,7 @@
# | {
# |
# | std::vector<int> v1;
# |
# | //
# |
# | + v1.reserve(10);
# |
# | for (int i = 0; i < 10; i++)
# |
# | v1.push_back(i);
# |
# | //
# |
# | @@ -107,6 +109,7 @@
# | {
# |
# | std::vector<int> v2;
# |
# | //
# |
# | + v2.reserve(10);
# |
# | for (int i = 0; i < 10; ++i)
# |
# | v2.push_back(0);
# |
# | //
# |
# | @@ -114,6 +117,7 @@
# | {
# |
# | std::vector<int> v3;
# |
# | //
# |
# | + v3.reserve(5);
# |
# | for (int i = 0; i < 5; ++i) {
# |
# | v3.push_back(i);
# |
# | //
# |
# | @@ -129,6 +133,7 @@
# | std::vector<int> v5;
# |
# | v5.reserve(3);
# |
# | //
# |
# | + v4.reserve(10);
# |
# | for (int i = 0; i < 10; ++i)
# |
# | v4.push_back(i);
# |
# | //
# |
# | @@ -136,6 +141,7 @@
# | {
# |
# | std::vector<int> v6;
# |
# | //
# |
# | + v6.reserve(t.size());
# |
# | for (std::size_t i = 0; i < t.size(); ++i) {
# |
# | v6.push_back(t[i]);
# |
# | //
# |
# | @@ -144,6 +150,7 @@
# | {
# |
# | std::vector<int> v7;
# |
# | //
# |
# | + v7.reserve(t.size() - 1);
# |
# | for (std::size_t i = 0; i < t.size() - 1; ++i) {
# |
# | v7.push_back(t[i]);
# |
# | } //
# |
# | @@ -151,6 +158,7 @@
# | {
# |
# | std::vector<int> v8;
# |
# | //
# |
# | + v8.reserve(t.size());
# |
# | for (const auto &e : t) {
# |
# | v8.push_back(e);
# |
# | //
# |
# | @@ -159,6 +167,7 @@
# | {
# |
# | std::vector<int> v9;
# |
# | //
# |
# | + v9.reserve(t.size());
# |
# | for (const auto &e : t) {
# |
# | v9.push_back(Op(e));
# |
# | //
# |
# | @@ -167,6 +176,7 @@
# | {
# |
# | std::vector<Foo> v10;
# |
# | //
# |
# | + v10.reserve(t.size());
# |
# | for (const auto &e : t) {
# |
# | v10.push_back(Foo(e));
# |
# | //
# |
# | @@ -175,6 +185,7 @@
# | {
# |
# | std::vector<Bar> v11;
# |
# | //
# |
# | + v11.reserve(t.size());
# |
# | for (const auto &e : t) {
# |
# | v11.push_back(e);
# |
# | //
# |
# | @@ -183,6 +194,7 @@
# | {
# |
# | std::vector<Foo> v12;
# |
# | //
# |
# | + v12.reserve(t.size());
# |
# | for (const auto &e : t) {
# |
# | v12.emplace_back(e);
# |
# | //
# |
# | @@ -192,6 +204,7 @@
# | {
# |
# | FooProto foo;
# |
# | //
# |
# | + foo.mutable_x()->Reserve(5);
# |
# | for (int i = 0; i < 5; i++) {
# |
# | foo.add_x(i);
# |
# | //
# |
# | @@ -322,6 +335,7 @@
# | {
# |
# | FooProto foo;
# |
# | //
# |
# | + foo.mutable_x()->Reserve(5);
# |
# | for (int i = 0; i < 5; i++) {
# |
# | foo.add_x(i);
# |
# | foo.add_x(i);
# |
# | @@ -340,6 +354,7 @@
# | BarProto bar;
# |
# | bar.mutable_x();
# |
# | //
# |
# | + foo.mutable_x()->Reserve(5);
# |
# | for (int i = 0; i < 5; i++) {
# |
# | foo.add_x();
# |
# | bar.add_x();
# |
# | @@ -367,6 +382,7 @@
# | std::vector<int> getNumbers() const {
# |
# | std::vector<int> Result;
# |
# | //
# |
# | + Result.reserve(Numbers.size());
# |
# | for (auto Number : Numbers) {
# |
# | Result.push_back(Number);
# |
# | //
# |
# | @@ -380,6 +396,7 @@
# | void foo(const StructWithFieldContainer &Src) {
# |
# | std::vector<int> A;
# |
# | //
# |
# | + A.reserve(Src.Numbers.size());
# |
# | for (auto Number : Src.Numbers) {
# |
# | A.push_back(Number);
# |
# | //
# |
# | @@ -396,6 +413,7 @@
# | {
# |
# | std::vector<int> gh95596_0;
# |
# | //
# |
# | + gh95596_0.reserve(10);
# |
# | for (unsigned i = 0; i < 10; ++i)
# |
# | gh95596_0.push_back(i);
# |
# | //
# |
# | @@ -403,6 +421,7 @@
# | {
# |
# | std::vector<int> gh95596_1;
# |
# | //
# |
# | + gh95596_1.reserve(10);
# |
# | for (int i = 0U; i < 10; ++i)
# |
# | gh95596_1.push_back(i);
# |
# | //
# |
# | @@ -410,6 +429,7 @@
# | {
# |
# | std::vector<int> gh95596_2;
# |
# | //
# |
# | + gh95596_2.reserve(10);
# |
# | for (unsigned i = 0U; i < 10; ++i)
# |
# | gh95596_2.push_back(i);
# |
# | //
# |
# | @@ -417,6 +437,7 @@
# | {
# |
# | std::vector<int> gh95596_3;
# |
# | //
# |
# | + gh95596_3.reserve(10U);
# |
# | for (int i = 0; i < 10U; ++i)
# |
# | gh95596_3.push_back(i);
# |
# | //
# |
# | @@ -430,6 +451,7 @@
# | std::vector<int> v2;
# |
# | //
# |
# | //
# |
# | + v1.reserve(10);
# |
# | for (int i = 0; i < 10; ++i) {
# |
# | v1.push_back(i);
# |
# | //
# |
# |
# | ------------------------------ Fixes -----------------------------
# | ---
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.orig
2026-02-03 16:01:54.266825100 +0000
# | +++
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp
2026-02-03 16:01:54.383451000 +0000
# | @@ -93,6 +93,7 @@
# | {
# |
# | std::vector<int> v0;
# |
# | //
# |
# | + v0.reserve(10);
# |
# | for (int i = 0; i < 10; ++i)
# |
# | v0.push_back(i);
# |
# | //
# |
# | @@ -100,6 +101,7 @@
# | {
# |
# | std::vector<int> v1;
# |
# | //
# |
# | + v1.reserve(10);
# |
# | for (int i = 0; i < 10; i++)
# |
# | v1.push_back(i);
# |
# | //
# |
# | @@ -107,6 +109,7 @@
# | {
# |
# | std::vector<int> v2;
# |
# | //
# |
# | + v2.reserve(10);
# |
# | for (int i = 0; i < 10; ++i)
# |
# | v2.push_back(0);
# |
# | //
# |
# | @@ -114,6 +117,7 @@
# | {
# |
# | std::vector<int> v3;
# |
# | //
# |
# | + v3.reserve(5);
# |
# | for (int i = 0; i < 5; ++i) {
# |
# | v3.push_back(i);
# |
# | //
# |
# | @@ -129,6 +133,7 @@
# | std::vector<int> v5;
# |
# | v5.reserve(3);
# |
# | //
# |
# | + v4.reserve(10);
# |
# | for (int i = 0; i < 10; ++i)
# |
# | v4.push_back(i);
# |
# | //
# |
# | @@ -136,6 +141,7 @@
# | {
# |
# | std::vector<int> v6;
# |
# | //
# |
# | + v6.reserve(t.size());
# |
# | for (std::size_t i = 0; i < t.size(); ++i) {
# |
# | v6.push_back(t[i]);
# |
# | //
# |
# | @@ -144,6 +150,7 @@
# | {
# |
# | std::vector<int> v7;
# |
# | //
# |
# | + v7.reserve(t.size() - 1);
# |
# | for (std::size_t i = 0; i < t.size() - 1; ++i) {
# |
# | v7.push_back(t[i]);
# |
# | } //
# |
# | @@ -151,6 +158,7 @@
# | {
# |
# | std::vector<int> v8;
# |
# | //
# |
# | + v8.reserve(t.size());
# |
# | for (const auto &e : t) {
# |
# | v8.push_back(e);
# |
# | //
# |
# | @@ -159,6 +167,7 @@
# | {
# |
# | std::vector<int> v9;
# |
# | //
# |
# | + v9.reserve(t.size());
# |
# | for (const auto &e : t) {
# |
# | v9.push_back(Op(e));
# |
# | //
# |
# | @@ -167,6 +176,7 @@
# | {
# |
# | std::vector<Foo> v10;
# |
# | //
# |
# | + v10.reserve(t.size());
# |
# | for (const auto &e : t) {
# |
# | v10.push_back(Foo(e));
# |
# | //
# |
# | @@ -175,6 +185,7 @@
# | {
# |
# | std::vector<Bar> v11;
# |
# | //
# |
# | + v11.reserve(t.size());
# |
# | for (const auto &e : t) {
# |
# | v11.push_back(e);
# |
# | //
# |
# | @@ -183,6 +194,7 @@
# | {
# |
# | std::vector<Foo> v12;
# |
# | //
# |
# | + v12.reserve(t.size());
# |
# | for (const auto &e : t) {
# |
# | v12.emplace_back(e);
# |
# | //
# |
# | @@ -192,6 +204,7 @@
# | {
# |
# | FooProto foo;
# |
# | //
# |
# | + foo.mutable_x()->Reserve(5);
# |
# | for (int i = 0; i < 5; i++) {
# |
# | foo.add_x(i);
# |
# | //
# |
# | @@ -322,6 +335,7 @@
# | {
# |
# | FooProto foo;
# |
# | //
# |
# | + foo.mutable_x()->Reserve(5);
# |
# | for (int i = 0; i < 5; i++) {
# |
# | foo.add_x(i);
# |
# | foo.add_x(i);
# |
# | @@ -340,6 +354,7 @@
# | BarProto bar;
# |
# | bar.mutable_x();
# |
# | //
# |
# | + foo.mutable_x()->Reserve(5);
# |
# | for (int i = 0; i < 5; i++) {
# |
# | foo.add_x();
# |
# | bar.add_x();
# |
# | @@ -367,6 +382,7 @@
# | std::vector<int> getNumbers() const {
# |
# | std::vector<int> Result;
# |
# | //
# |
# | + Result.reserve(Numbers.size());
# |
# | for (auto Number : Numbers) {
# |
# | Result.push_back(Number);
# |
# | //
# |
# | @@ -380,6 +396,7 @@
# | void foo(const StructWithFieldContainer &Src) {
# |
# | std::vector<int> A;
# |
# | //
# |
# | + A.reserve(Src.Numbers.size());
# |
# | for (auto Number : Src.Numbers) {
# |
# | A.push_back(Number);
# |
# | //
# |
# | @@ -396,6 +413,7 @@
# | {
# |
# | std::vector<int> gh95596_0;
# |
# | //
# |
# | + gh95596_0.reserve(10);
# |
# | for (unsigned i = 0; i < 10; ++i)
# |
# | gh95596_0.push_back(i);
# |
# | //
# |
# | @@ -403,6 +421,7 @@
# | {
# |
# | std::vector<int> gh95596_1;
# |
# | //
# |
# | + gh95596_1.reserve(10);
# |
# | for (int i = 0U; i < 10; ++i)
# |
# | gh95596_1.push_back(i);
# |
# | //
# |
# | @@ -410,6 +429,7 @@
# | {
# |
# | std::vector<int> gh95596_2;
# |
# | //
# |
# | + gh95596_2.reserve(10);
# |
# | for (unsigned i = 0U; i < 10; ++i)
# |
# | gh95596_2.push_back(i);
# |
# | //
# |
# | @@ -417,6 +437,7 @@
# | {
# |
# | std::vector<int> gh95596_3;
# |
# | //
# |
# | + gh95596_3.reserve(10U);
# |
# | for (int i = 0; i < 10U; ++i)
# |
# | gh95596_3.push_back(i);
# |
# | //
# |
# | @@ -430,6 +451,7 @@
# | std::vector<int> v2;
# |
# | //
# |
# | //
# |
# | + v1.reserve(10);
# |
# | for (int i = 0; i < 10; ++i) {
# |
# | v1.push_back(i);
# |
# | //
# |
# |
# | ------------------------------------------------------------------
# | FileCheck
--input-file=C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp
C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\performance\inefficient-vector-operation.cpp
--check-prefixes=CHECK-FIXES --match-full-lines failed:
# |
C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\performance\inefficient-vector-operation.cpp:317:22:
error: CHECK-FIXES-NOT: excluded string found in input
# |
# | // CHECK-FIXES-NOT: foo.mutable_x()->Reserve(5);
# |
# | ^
# |
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:338:2:
note: found here
# |
# | foo.mutable_x()->Reserve(5);
# |
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
# |
C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\performance\inefficient-vector-operation.cpp:324:22:
error: CHECK-FIXES-NOT: excluded string found in input
# |
# | // CHECK-FIXES-NOT: foo.mutable_x()->Reserve(5);
# |
# | ^
# |
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:338:2:
note: found here
# |
# | foo.mutable_x()->Reserve(5);
# |
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
# |
C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\performance\inefficient-vector-operation.cpp:332:22:
error: CHECK-FIXES-NOT: excluded string found in input
# |
# | // CHECK-FIXES-NOT: foo.mutable_x()->Reserve(5);
# |
# | ^
# |
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:338:2:
note: found here
# |
# | foo.mutable_x()->Reserve(5);
# |
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
# |
C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\performance\inefficient-vector-operation.cpp:342:22:
error: CHECK-FIXES-NOT: excluded string found in input
# |
# | // CHECK-FIXES-NOT: foo.mutable_x()->Reserve(5);
# |
# | ^
# |
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:338:2:
note: found here
# |
# | foo.mutable_x()->Reserve(5);
# |
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
# |
C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\performance\inefficient-vector-operation.cpp:351:22:
error: CHECK-FIXES-NOT: excluded string found in input
# |
# | // CHECK-FIXES-NOT: foo.mutable_x()->Reserve(5);
# |
# | ^
# |
# |
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp:338:2:
note: found here
# |
# | foo.mutable_x()->Reserve(5);
# |
# | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |
# |
# |
# | Input file:
C:\_work\llvm-project\llvm-project\build\tools\clang\tools\extra\test\clang-tidy\checkers\performance\Output\inefficient-vector-operation.cpp.tmp.cpp
# |
# | Check file:
C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\checkers\performance\inefficient-vector-operation.cpp
# |
# |
# |
# | -dump-input=help explains the following input dump.
# |
# |
# |
# | Input was:
# |
# | <<<<<<
# |
# | .
# |
# | .
# |
# | .
# |
# | 333: }
# |
# | 334: }
# |
# | 335: {
# |
# | 336: FooProto foo;
# |
# | 337: //
# |
# | 338: foo.mutable_x()->Reserve(5);
# |
# | not:317 !~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match expected
# |
# | not:324 !~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match expected
# |
# | not:332 !~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match expected
# |
# | not:342 !~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match expected
# |
# | not:351 !~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match expected
# |
# | 339: for (int i = 0; i < 5; i++) {
# |
# | 340: foo.add_x(i);
# |
# | 341: foo.add_x(i);
# |
# | 342: }
# |
# | 343: }
# |
# | .
# |
# | .
# |
# | .
# |
# | >>>>>>
# |
# |
# `-----------------------------
# .---command stderr------------
# | Traceback (most recent call last):
# | File
"C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py",
line 413, in <module>
# | main()
# | File
"C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py",
line 409, in main
# | CheckRunner(args, extra_args).run()
# | File
"C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py",
line 311, in run
# | self.check_fixes()
# | File
"C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py",
line 255, in check_fixes
# | try_run(
# | File
"C:\_work\llvm-project\llvm-project\clang-tools-extra\test\clang-tidy\check_clang_tidy.py",
line 63, in try_run
# | process_output = subprocess.check_output(args,
stderr=subprocess.STDOUT).decode(
# | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# | File "c:\python312\Lib\subprocess.py", line 466, in check_output
# | return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
# | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# | File "c:\python312\Lib\subprocess.py", line 571, in run
# | raise CalledProcessError(retcode, process.args,
# | subprocess.CalledProcessError: Command '['FileCheck',
'--input-file=C:\\_work\\llvm-project\\llvm-project\\build\\tools\\clang\\tools\\extra\\test\\clang-tidy\\checkers\\performance\\Output\\inefficient-vector-operation.cpp.tmp.cpp',
'C:\\_work\\llvm-project\\llvm-project\\clang-tools-extra\\test\\clang-tidy\\checkers\\performance\\inefficient-vector-operation.cpp',
'--check-prefixes=CHECK-FIXES', '--match-full-lines']' returned non-zero exit
status 1.
# `-----------------------------
# error: command failed with exit status: 1
--
```
</details>
If these failures are unrelated to your changes (for example tests are broken
or flaky at HEAD), please open an issue at
https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.
https://github.com/llvm/llvm-project/pull/179484
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits