aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/COFFObjectFile.cpp
diff options
context:
space:
mode:
authorJan Kokemüller <jan.kokemueller@gmail.com>2024-04-03 01:09:26 +0200
committerGitHub <noreply@github.com>2024-04-02 16:09:26 -0700
commit84ae8cb4af9abafe9f45e69744607aadb38d649a (patch)
tree6870e8d28b595de1f699f98ad1ce16f589bdc334 /llvm/lib/Object/COFFObjectFile.cpp
parent12c7371296e59c22debdd906f632c5e6574e3a44 (diff)
downloadllvm-84ae8cb4af9abafe9f45e69744607aadb38d649a.zip
llvm-84ae8cb4af9abafe9f45e69744607aadb38d649a.tar.gz
llvm-84ae8cb4af9abafe9f45e69744607aadb38d649a.tar.bz2
[libc++] `std::ranges::advance`: avoid unneeded bounds checks when advancing iterator (#84126)
Currently, the bounds check in `std::ranges::advance(it, n, s)` is done _before_ `n` is checked. This results in one extra, unneeded bounds check. Thus, `std::ranges::advance(it, 1, s)` currently is _not_ simply equivalent to: ```c++ if (it != s) { ++it; } ``` This difference in behavior matters when the check involves some "expensive" logic. For example, the `==` operator of `std::istreambuf_iterator` may actually have to read the underlying `streambuf`. Swapping around the checks in the `while` results in the expected behavior.
Diffstat (limited to 'llvm/lib/Object/COFFObjectFile.cpp')
0 files changed, 0 insertions, 0 deletions