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.
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.

PiperOrigin-RevId: 307516853
Change-Id: I2a55cfe4004fd23c421af3ed7cbc05525c24f35e

GoogleCloudPlatform/cloud-debug-java,GoogleCloudPlatform/cloud-debug-java,GoogleCloudPlatform/cloud-debug-java,GoogleCloudPlatform/cloud-debug-java