[llvm] Change `auto` to `const auto &` to avoid copying (PR #102122)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 6 04:08:49 PDT 2024
https://github.com/abhishek-kaushik22 created https://github.com/llvm/llvm-project/pull/102122
Change `auto` to `const auto &` to avoid copying in `MachObjectWriter::bindIndirectSymbols`
>From f478ef876b52ce7addb2b1efb5971bf4781a473f Mon Sep 17 00:00:00 2001
From: abhishek-kaushik22 <abhishek.kaushik at intel.com>
Date: Tue, 6 Aug 2024 16:37:34 +0530
Subject: [PATCH] Change `auto` to `const auto &` to avoid copying in
`MachObjectWriter::bindIndirectSymbols`
---
llvm/lib/MC/MachObjectWriter.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp
index 8596f457574a3..dce043d17a594 100644
--- a/llvm/lib/MC/MachObjectWriter.cpp
+++ b/llvm/lib/MC/MachObjectWriter.cpp
@@ -541,7 +541,7 @@ void MachObjectWriter::bindIndirectSymbols(MCAssembler &Asm) {
}
// Bind non-lazy symbol pointers first.
- for (auto [IndirectIndex, ISD] : enumerate(IndirectSymbols)) {
+ for (const auto &[IndirectIndex, ISD] : enumerate(IndirectSymbols)) {
const auto &Section = cast<MCSectionMachO>(*ISD.Section);
if (Section.getType() != MachO::S_NON_LAZY_SYMBOL_POINTERS &&
@@ -555,7 +555,7 @@ void MachObjectWriter::bindIndirectSymbols(MCAssembler &Asm) {
}
// Then lazy symbol pointers and symbol stubs.
- for (auto [IndirectIndex, ISD] : enumerate(IndirectSymbols)) {
+ for (const auto &[IndirectIndex, ISD] : enumerate(IndirectSymbols)) {
const auto &Section = cast<MCSectionMachO>(*ISD.Section);
if (Section.getType() != MachO::S_LAZY_SYMBOL_POINTERS &&
More information about the llvm-commits
mailing list