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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: Vladislav Khmelevsky (yota9)

<details>
<summary>Changes</summary>

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


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


1 Files Affected:

- (modified) bolt/lib/Rewrite/RewriteInstance.cpp (+4-2) 


``````````diff
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,

``````````

</details>


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


More information about the llvm-commits mailing list