From ad2816e7340be71c93e60b9bb58e107fe1b76e4d Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Fri, 26 Apr 2024 23:10:20 +0000 Subject: [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 --- llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp b/llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp index cda0440..89d7b19 100644 --- a/llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp +++ b/llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp @@ -143,7 +143,7 @@ Expected 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"; -- cgit v1.1