[llvm] [Object] Avoid repeated map lookups (NFC) (PR #126853)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 11 21:03:01 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-binary-utilities

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/126853.diff


1 Files Affected:

- (modified) llvm/lib/Object/GOFFObjectFile.cpp (+1-2) 


``````````diff
diff --git a/llvm/lib/Object/GOFFObjectFile.cpp b/llvm/lib/Object/GOFFObjectFile.cpp
index db1e7e704f62e..7806953aecd29 100644
--- a/llvm/lib/Object/GOFFObjectFile.cpp
+++ b/llvm/lib/Object/GOFFObjectFile.cpp
@@ -564,8 +564,7 @@ section_iterator GOFFObjectFile::section_end() const {
 
 void GOFFObjectFile::moveSymbolNext(DataRefImpl &Symb) const {
   for (uint32_t I = Symb.d.a + 1, E = EsdPtrs.size(); I < E; ++I) {
-    if (EsdPtrs[I]) {
-      const uint8_t *EsdRecord = EsdPtrs[I];
+    if (const uint8_t *EsdRecord = EsdPtrs[I]) {
       GOFF::ESDSymbolType SymbolType;
       ESDRecord::getSymbolType(EsdRecord, SymbolType);
       // Skip EDs - i.e. section symbols.

``````````

</details>


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


More information about the llvm-commits mailing list