Change for loops to use const references where they did not previously

From cl/304219049:

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

Change-Id: Ia91f03740bb57cabc3cad461f4d43cd8f1df8117
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/2132844
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
GitOrigin-RevId: 194e23910c13a68097f7dc7d058fdecd5ebd0b08
2 files changed
tree: 39f6311adc720b0fe9d05ea888ceb48d8a429289
  1. build/
  2. client/
  3. compat/
  4. doc/
  5. handler/
  6. infra/
  7. minidump/
  8. snapshot/
  9. test/
  10. third_party/
  11. tools/
  12. util/
  13. .clang-format
  14. .gitattributes
  15. .gitignore
  16. .gn
  17. .vpython
  18. AUTHORS
  19. BUILD.gn
  20. codereview.settings
  21. CONTRIBUTORS
  22. crashpad.gyp
  23. DEPS
  24. LICENSE
  25. navbar.md
  26. package.h
  27. README.md
README.md

Crashpad

Crashpad is a crash-reporting system.

Documentation

Source Code

Crashpad’s source code is hosted in a Git repository at https://chromium.googlesource.com/crashpad/crashpad.

Other Links