Skip to content

Commit ad2816e

Browse files
[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
1 parent 5569c21 commit ad2816e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Expected<int> SubprocessMemory::setupAuxiliaryMemoryInSubprocess(
143143
}
144144

145145
SubprocessMemory::~SubprocessMemory() {
146-
for (std::string SharedMemoryName : SharedMemoryNames) {
146+
for (const std::string &SharedMemoryName : SharedMemoryNames) {
147147
if (shm_unlink(SharedMemoryName.c_str()) != 0) {
148148
errs() << "Failed to unlink shared memory section: " << strerror(errno)
149149
<< "\n";

0 commit comments

Comments
 (0)