[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
This commit is contained in:
Aiden Grossman 2024-04-26 23:10:20 +00:00
parent 5569c219d3
commit ad2816e734

View File

@ -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";