[llvm] ad2816e - [llvm-exegesis] Use const reference for range variable
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 26 16:12:31 PDT 2024
Author: Aiden Grossman
Date: 2024-04-26T23:10:20Z
New Revision: ad2816e7340be71c93e60b9bb58e107fe1b76e4d
URL: https://github.com/llvm/llvm-project/commit/ad2816e7340be71c93e60b9bb58e107fe1b76e4d
DIFF: https://github.com/llvm/llvm-project/commit/ad2816e7340be71c93e60b9bb58e107fe1b76e4d.diff
LOG: [llvm-exegesis] Use const reference for range variable
In the SubprocessMemory destructor, I was using a normal std::string to
hold the name of the current shared memory name, but a const reference
works just as well in this situation while having better performance
characteristics.
Fixes #90289
Added:
Modified:
llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp b/llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp
index cda04405050201..89d7b197079e4f 100644
--- a/llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp
+++ b/llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp
@@ -143,7 +143,7 @@ Expected<int> SubprocessMemory::setupAuxiliaryMemoryInSubprocess(
}
SubprocessMemory::~SubprocessMemory() {
- for (std::string SharedMemoryName : SharedMemoryNames) {
+ for (const std::string &SharedMemoryName : SharedMemoryNames) {
if (shm_unlink(SharedMemoryName.c_str()) != 0) {
errs() << "Failed to unlink shared memory section: " << strerror(errno)
<< "\n";
More information about the llvm-commits
mailing list