<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94107>94107</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang/lib/Driver/ToolChains/Clang.cpp:2734: 2 * Poor choice of variable type ?
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:driver,
code-quality
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dcb314
</td>
</tr>
</table>
<pre>
Static analyser cppcheck says:
clang/lib/Driver/ToolChains/Clang.cpp:2734:63: performance: Function parameter 'str1' should be passed by const reference. [passedByValue]
clang/lib/Driver/ToolChains/Clang.cpp:2735:46: performance: Function parameter 'str2' should be passed by const reference. [passedByValue]
Source code is
static void EmitComplexRangeDiag(const Driver &D, std::string str1,
std::string str2) {
Suggest new code:
static void EmitComplexRangeDiag(const Driver &D, const std::string & str1,
const std::string & str2) {
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykk8-PnDoMx_8ac7F2BA4_hgMHZnicn94-9R6CB9IGQpMwLf99xbBV29WqUreXIGzL_nz9Q3qvh5m5guwCWRPJNYzWVb3qRJJGne236jnIoBXKWZrNs0O1LGpk9Qm93DyIGuIG4pdXGTkPQK3RHVDbOH1nB9T-b625jlLPHqi97jEntSwgaipECqLOBYgaF3Y36yY5K95_23VWQdsZF-nkxIEdAhU-uASoQD_a1fTYMS7Se-6x21DZ2Qd0fGPHs-ITQnY5vJftgzQrQ9a8mzMDUaf5n3DS33Me77NdnWJUtmfU_mePP2Zzt7rHfyYdrnZaDH_9T84DN1oOQOej2CERgfIG6Io-9PvkRO2D0_OAR1evR9K3vARUIhSXX7DWYWAfcOYvD7ZXu_BetsP4mgEof0X527i3eKO-En0pShlxlRRJQSIXRR6NVXfriqyUilSZxYk8Z7IvZdYVSSpuRUa3SFcUUxrncZLEcZ7kp7w8J4rPvRBx3ikSkMY8SW1Oxtynk3VDpL1fuSrTJC4iIzs2_nFiRMfqibp_WTraFRHtDXz6vEqjw7YbsyZy1Z7tqVsHD2lstA_-R_6gg-HqnfeGhEA1_mutQzVarRjtDe_SadkZxrAtjCDaaHWmGkNYHmdOLVA76DCu3UnZaa9q7t8_T4uzH1kFoPahfC98iL9X9C0AAP__s4RhqQ">