<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/62926>62926</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy check bugprone-swapped-arguments only reports some swapped function calls
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          cat38275
      </td>
    </tr>
</table>

<pre>
    Testing under Windows 10 with LLVM version 16.0.4
I have the source code file, called "code_test.cpp" and the full file is:

```
void paramsIntAndFloat(int nFirst, float fSecond) { }
void paramsFloatAndShort(float fFirst, short nSecond) { }
void foo(int, double) { }

static void checkSwappedArguments()
{
        float fArgument = 32.9f;
        short nArgument = 12;
        paramsIntAndFloat(fArgument, 2);
        paramsIntAndFloat(83.746, nArgument);
        paramsFloatAndShort(nArgument, 29.7);
        paramsFloatAndShort(81, 29.7);
        paramsIntAndFloat(2.0, 4);
        foo(2.0, 4);
}
```
I run the clang-tidy command:

`clang-tidy code_test.cpp -checks=-*,bugprone-swapped-arguments --`

and I get the output:

```
5 warnings generated.
c:\src\code_test.cpp:9:2: warning: argument with implicit conversion from 'int' to 'float' followed by argument converted from 'float' to 'int', potentially swapped arguments. [bugprone-swapped-arguments]
        paramsIntAndFloat(fArgument, 2);
 ^                 ~~~~~~~~~  ~
                          2 fArgument
c:\src\code_test.cpp:14:2: warning: argument with implicit conversion from 'int' to 'double' followed by argument converted from 'double' to 'int', potentially swapped arguments. [bugprone-swapped-arguments]
        foo(2.0, 4);
        ^   ~~~ ~
            4    2.0
Suppressed 3 warnings (3 with check filters).
```

since the final function call "foo(2.0, 4)" is being picked up, the function call one line above "paramsIntAndFloat(2.0, 4)" definitely should be picked up.  As far as I can tell all 6 function calls should be picked up, rather than just 2 of them.

I had exactly the same results in clang-tidy version 15.0.6
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/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