Skip to content

[BOLT][NFC] Fix build #99361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 17, 2024
Merged

[BOLT][NFC] Fix build #99361

merged 1 commit into from
Jul 17, 2024

Conversation

yota9
Copy link
Member

@yota9 yota9 commented Jul 17, 2024

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

@yota9 yota9 added the BOLT label Jul 17, 2024
@yota9 yota9 requested a review from mtvec July 17, 2024 17:36
@llvmbot
Copy link
Member

llvmbot commented Jul 17, 2024

@llvm/pr-subscribers-bolt

Author: Vladislav Khmelevsky (yota9)

Changes

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

Copy link
Contributor

@aaupov aaupov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. I've upgraded the compiler on a buildbot just in case.

@@ -1500,7 +1502,7 @@ void RewriteInstance::registerFragments() {
}
BC->errs() << "BOLT-ERROR: parent function not found for " << *BF << '\n';
exit(1);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Format

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is made by git clang-format ¯_(ツ)_/¯ And the formatting test here is passed too. What shell I do remove and push or go as-is?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks to me like a bug and I agree that this space removing is not needed. Probably we can push now and close the eyes at this problem @aaupov ?

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

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff b5b9832b42f436986c7290bc1e912e2f276b4e6b 03e03ff14355696b888cbf0d141b204ca71c17e2 --extensions cpp -- bolt/lib/Rewrite/RewriteInstance.cpp
View the diff from clang-format here.
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index 4ae802dc97..903aadf843 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -1502,7 +1502,7 @@ registerParent:
     }
     BC->errs() << "BOLT-ERROR: parent function not found for " << *BF << '\n';
     exit(1);
-  }
+}
 }
 
 void RewriteInstance::createPLTBinaryFunction(uint64_t TargetAddress,

@aaupov
Copy link
Contributor

aaupov commented Jul 17, 2024

Yes, disregard formatter warning

@yota9 yota9 merged commit 51122fb into llvm:main Jul 17, 2024
3 of 5 checks passed
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
Summary:
On clang 14 the build is failing with:
reference to local binding 'ParentName' declared in enclosing function
'llvm::bolt::RewriteInstance::registerFragments'

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60250860
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants