<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/128510>128510</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] narrowing conversion should highlight the last function name in the call chain
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
maxim-banaev
</td>
</tr>
</table>
<pre>
In this example, `size()` should be highlighted instead of `vec`.
```
#include <vector>
int main()
{
std::vector<int> vec{1, 2, 3};
int a = vec.size();
return 0;
}
```
clang-tidy output:
```
clang-tidy main.cpp -checks="-*,*-narrowing-conversions"
.../main.cpp:6:13: warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
6 | int a = vec.size();
| ^
```
clang-tidy version is 21.0.0
llvm-project revision: 2b71df5a74cb5bd67f3f34277749dc920fd35105
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMk92uozYQx59muBkFmTHg5IILTnIi9SkqYxtw19gIm-yePn3lbJJzWnWrRlZAw2_G858PGaOdvDEdNG_QXAq5pzls3SJ_2OUwSC_NrRiC_uh-85hmG9H8kMvqDNAZoWXR_mmAjkAnaBnGOexO42BwttPs7DQno9H6mIzUGMbscTMKWlYC6_Np2eOwHohbr9yuDQI_34xKYQP-_hO0PuEirX_cxXoQb8B6RMSYNPAeeP90OVufgL9jvkm8VTlTyn8cxAX40y1HlAj8krnyi44XsZm0bx7ZT0t2_kfCrFdO-umQrP7AsKd1TzmTv1NfkCygVOuKBzUb9S0CvwDRAagHOgP1By-3LXy3fjqo4G9mizb4CETA-rIsga7PCMD7FnhfceA9fpebt37Kr68A-BkAxy0sCCSyxt_Tx2qABAId5TeZzbu_T4BGF_wEJIBOmAI-jJnPVK4pCbQRbW7_YnySyQZ_0Ga0GYTmbdindQve_ErHWa2rCpuZdquNs97EX5BNLjW2COKM_69X-GKfP2je_7Nfz-rYiFSVrMyEc7flsG7hD6MSbuZmM5HrSoOo9NhIUauhGXQrRj7ymoQQ9UmrE7FR86ZiTaE7rk_8JAvTVaJmNeM1q4u5a1nb6mocpFLKsPbYat3WZhiUkK2SWhS2I0YNI6orTpzqkpgkqVs6tg2dxlpCzcwirStzkmXYpsLGuJuuomNTscLJwbh432KiT5l5eJpLsXV3acM-RaiZszHFzzjJJnff_y9uzeXfZ-mx4a_1xjQbdDImHHev8kCgl4tB6-9flHQO1SytL_bNdXNKa8wrQleg62TTvA-lCgvQNWfzeDw7AHS9S4xA14fKW0d_BQAA___GoHGh">