<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/95640>95640</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
llvm/include/llvm/Support/Memory.h:140: Pointless copy ?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
code-quality,
llvm:support
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dcb314
</td>
</tr>
</table>
<pre>
Static analyser cppcheck says:
llvm/include/llvm/Support/Memory.h:140:44: performance: Function parameter 'M' should be passed by const reference. [passedByValue]
Source code is
explicit OwningMemoryBlock(MemoryBlock M) : M(M) {}
Suggest new code:
explicit OwningMemoryBlock( const MemoryBlock & M) : M(M) {}
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycks1unDAQx59muIyyggEWfOCw24jbqpUi9W7MLLjx2tQfSXn7CpIq2x5aqRekmZH-H_gnQ9CTZe6gPkP9mMkUZ-e7UQ1lUWWDG9fuKcqoFUorzRrYo1oWNbN6xiDXAOUJ8kfI37_GvNyAem2VSSMD9e-Lp7Qszkeg_sI359fDDOWpqHIoT1UF5QkX9lfnb9Iq3sY-WRW1s7hIL28c2SNQcwFqMMwumREHxkWGwCMOKypnQ0TPV_ZsFR8Q6vPb9bx-lSYx1I_3MZ9c8opRuZFRh_sLIiL_WIxWOuLnV6vt9Jb4bJx6BmrvJrwACdziXrbDPjRnaH63StPEIaLl193vjx_2d7P3YveeQMd_-GZjV46iFDLjrmiKtirrthXZ3LU0krgKSddGCipqkR-rdijESGNTt1xluqOcqvxY1HlTtLk4NFwQU1MLKqm8koAq55vU5rA968H5KdMhJO5EfazyzMiBTdhJItq6PnxP0ui4AhHQJyDaaShP4RcNtCHnu239MKQpQJUbHWL40I86Gu7-Ayv84rSNhkNA5ZYVoeyz5E03x7js1FIP1E86zmk4KHf7EN3TLN59Y7Up7w0DUP9W8qWjnwEAAP__pIX9xg">