[llvm] Prefer const auto& to copying the entire object (PR #99830)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 22 14:29:55 PDT 2024
dwblaikie wrote:
How'd you come up with this change? It'd be good to understand how the change is generated so we know it's updating code in a positive way.
For instance - if the type that `auto` is binding to is small enough, the copy may be suitable (eg: if it's int, or pointer - one or two words, basically) to keep it as a copy (the same as we do for function parameters - int and pointer passed by value, but larger things passed by const ref)
@kazutakahirata as someone who does a lot of this sort of cleanup, they might have a better eye for this sort of change
https://github.com/llvm/llvm-project/pull/99830
More information about the llvm-commits
mailing list