Skip to content

Commit

Permalink
[llvm-exegesis] Use const reference for range variable
Browse files Browse the repository at this point in the history
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
  • Loading branch information
boomanaiden154 committed Apr 26, 2024
1 parent 5569c21 commit ad2816e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/tools/llvm-exegesis/lib/SubprocessMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit ad2816e

Please sign in to comment.