<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/92756>92756</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
trunk/clang/include/clang/ExtractAPI/DeclarationFragments.h: 4 * Function parameter should be passed by const reference
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dcb314
</td>
</tr>
</table>
<pre>
Static analyser cppcheck says:
trunk/clang/include/clang/ExtractAPI/DeclarationFragments.h:202:45: performance: Function parameter 'NewSpelling' should be passed by const reference. [passedByValue]
trunk/clang/include/clang/ExtractAPI/DeclarationFragments.h:243:29: performance: Function parameter 'Access' should be passed by const reference. [passedByValue]
trunk/clang/include/clang/ExtractAPI/DeclarationFragments.h:265:52: performance: Function parameter 'Fragments' should be passed by const reference. [passedByValue]
trunk/clang/include/clang/ExtractAPI/DeclarationFragments.h:278:43: performance: Function parameter 'RT' should be passed by const reference. [passedByValue]
For the first one, the source code is:
DeclarationFragments &replace(std::string NewSpelling, unsigned Position) {
Maybe better code:
DeclarationFragments &replace( const std::string & NewSpelling, unsigned Position) {
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzMlM9u2zgQxp9mdBnEkCjq30EHOV4Be9hFsFn0TpFjiQ1NCiTV1m9f0DHaNMjBRXPIZQRRGvL7Db8ZEYKeLVEP1R6qQya2uDjfKzmVBc8mp879YxRRSxRWmHMgj3Jd5ULyCYM4BygHyA-QX2P0m30CNkoj7Axs1FaaTdGLlb--RS9kHB7-BjYeSBrhRdTOjl7MJ7Ix7BYoB5YzKAdeQTngSv7o_ElYSel13KxMCbgKL04UySOw5l_6-riSMTod0mBY3GYUToSrCIEUTmeUzoaIno7kyUraIVT756_78ydhNoLq8M4UvEyxu5likJJC-EAAdbqBit0M8CP9AzE0bbJSeTPDf___ufjnODqPcSE8ah8iOkvA7i8LwW1eEkqnCPXrHsK3UBBY7Wk1QhKwNkSVksohRK_tjL-4_x43e2lqhQ8u6LQNsA6h2b885R9xnggniok6CXmt4gYZ14K8VgOs_j1FmepL1ZWdyKgvmqJmRdV2PFt61eYkeCeJVyTzpjpK1VKRq7wWxZE3TaZ7ljOeVywveNkWfNdRyYm3RV1JXsjiCDynk9BmZ8yX0875OdMhbNR3rKnqzIiJTLjMPsautmJpDPo-_X83bXMAnhsdYvi5Q9TRUP9e_kSOwN704g0WzDZv-iXG9WIiNgIbZx2XbdpJdwI2Js3Xx93q3WeSMUlNJQjAxksVvgcAAP__-AT66g">