[llvm] [NFC] Use references to avoid copying (PR #110462)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 18 00:58:43 PDT 2024


================
@@ -346,7 +346,7 @@ static constexpr {} IIT_Table[] = {{
                 FixedEncodingTypeName);
 
   unsigned MaxOffset = 0;
-  for (auto [Idx, FixedEncoding, Int] : enumerate(FixedEncodings, Ints)) {
+  for (const auto [Idx, FixedEncoding, Int] : enumerate(FixedEncodings, Ints)) {
----------------
phoebewang wrote:

I don't know why leaving `const` here. I had a quick search. `const auto [` is much smaller used in LLVM code base.
```
$ grep -r 'const auto \[' llvm/| wc
     37     275    3760
$ grep -r 'auto \[' llvm/| wc
    817    5871   82133
```

https://github.com/llvm/llvm-project/pull/110462


More information about the llvm-commits mailing list