[llvm] [BOLT][NFC] Fix build (PR #99361)

Vladislav Khmelevsky via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 10:36:23 PDT 2024


https://github.com/yota9 created https://github.com/llvm/llvm-project/pull/99361

On clang 14 the build is failing with:
reference to local binding 'ParentName' declared in enclosing function
'llvm::bolt::RewriteInstance::registerFragments'


>From ab80b0026971c3e8fdbf4d15f3b9af145e7537ae Mon Sep 17 00:00:00 2001
From: Vladislav Khmelevsky <och95 at yandex.ru>
Date: Wed, 17 Jul 2024 21:33:39 +0400
Subject: [PATCH] [BOLT][NFC] Fix build

On clang 14 the build is failing with:
reference to local binding 'ParentName' declared in enclosing function
'llvm::bolt::RewriteInstance::registerFragments'
---
 bolt/lib/Rewrite/RewriteInstance.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index 32562ccb6b345..903aadf843602 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -1432,7 +1432,9 @@ void RewriteInstance::registerFragments() {
   // of the last local symbol.
   ELFSymbolRef LocalSymEnd = ELF64LEFile->toSymbolRef(SymTab, SymTab->sh_info);
 
-  for (auto &[ParentName, BF] : AmbiguousFragments) {
+  for (auto &Fragment : AmbiguousFragments) {
+    const StringRef &ParentName = Fragment.first;
+    BinaryFunction *BF = Fragment.second;
     const uint64_t Address = BF->getAddress();
 
     // Get fragment's own symbol
@@ -1500,7 +1502,7 @@ void RewriteInstance::registerFragments() {
     }
     BC->errs() << "BOLT-ERROR: parent function not found for " << *BF << '\n';
     exit(1);
-  }
+}
 }
 
 void RewriteInstance::createPLTBinaryFunction(uint64_t TargetAddress,



More information about the llvm-commits mailing list