-
Change for loops to use const refs, per performance-for-range-copy clang-tidy. · 9aff7ae7Ben Clayton authored
This CL optimizes C++11 range-based for loops where the variable is copied in each iteration but it would suffice to obtain it by const reference. This is only applied to loop variables of types that are expensive to copy which means they are not trivially copyable or have a non-trivial copy constructor or destructor. To ensure that it is safe to replace the copy with a const reference the following heuristic is employed: The loop variable is const qualified. The loop variable is not const, but only const methods or operators are invoked on it, or it is used as const reference or value argument in constructors or function calls. See cl/304001946 for more information. Bug: None. Change-Id: Idbb5a0dbf19c6dccb16a0d525900aa99419a8527 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/43368 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by:
Nicolas Capens <nicolascapens@google.com> Tested-by:
Ben Clayton <bclayton@google.com>
9aff7ae7
×