diff options
author | Mehdi Amini <joker.eph@gmail.com> | 2020-11-14 00:46:30 +0000 |
---|---|---|
committer | Mehdi Amini <joker.eph@gmail.com> | 2020-11-14 00:55:33 +0000 |
commit | 42e88bd6b18597fe0a46ee9663d4e2cf2f7a4e57 (patch) | |
tree | 97cbeee72b45208ad5318a0c9a72bd71fd34c09f /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 703ef17e7a0a0f51e1d000bb1f71ad437a9933e4 (diff) | |
download | llvm-42e88bd6b18597fe0a46ee9663d4e2cf2f7a4e57.zip llvm-42e88bd6b18597fe0a46ee9663d4e2cf2f7a4e57.tar.gz llvm-42e88bd6b18597fe0a46ee9663d4e2cf2f7a4e57.tar.bz2 |
Replace sequences of v.push_back(v[i]); v.erase(&v[i]); with std::rotate (NFC)
The code has a few sequence that looked like:
Ops.push_back(Ops[0]);
Ops.erase(Ops.begin());
And are equivalent to:
std::rotate(Ops.begin(), Ops.begin() + 1, Ops.end());
The latter has the advantage of never reallocating the vector, which
would be a bug in the original code as push_back would read from the
memory it deallocated.
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions