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

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] when try to use code action to fix the function pointer not initialized problem, clang-tidy add =nullptr to the wrong place
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

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

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

<pre>
    code example:

```cpp
int main() {
 void(*f)(void*);
}
```

the function pointer `f` is not initialized, and clang-tidy suggest to add `=nullptr` to initialize it. but clang-tidy add it to a wrong position:

code example from @[HighCommander4](https://github.com/HighCommander4)

```console
$ cat test.cpp
int main() {
    void(*f)(void*);
}

$ clang-tidy --checks=cppcoreguidelines-init-variables --fix test.cpp
Running without flags.
1 warning generated.
test.cpp:2:11: warning: variable 'f' is not initialized [cppcoreguidelines-init-variables]
    2 | void(*f)(void*);
      |           ^
      |             = nullptr
test.cpp:2:12: note: FIX-IT applied suggested code changes
 2 |     void(*f)(void*);
      |            ^
clang-tidy applied 1 of 1 suggested fixes.

$ cat test.cpp
int main() {
    void(*f = nullptr)(void*);
}
```

expected behaviour:

```cpp
int main() {
    void(*f)(void*)=nullptr;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVV-Pq7YT_TTDy4jIDBCSBx6ym1_0u1Kfqj7cPhoYwK2xkW2yu_30lfNnk0Z7u-2qKCLJ2HPmcGZ8kN6rwTDXUD5BuU_kEkbr6p--_yoN5XmeNLZ7q1vbMfKrnGbNkO9A7EFc72tx_rTzfI4oE3CSygBtgLYI1dM5jkerulNw1wNtgTbnwC7-yS-boNo_4N4XCyNjv5g2KGtwtsoEdghr0cNaoPJobEBlVFBSqz-4A3pGaTpstTRDGlT3hn4ZBvYBg0XZdTEX8r1ZtJ6DiyDB3gGgCitslnAPELPUOR9fnDUDztarSOhBmHvNsHd2QigElE__V8P4bKdJmo5dAeUeaDOGMPuYTwegw6DCuDSr1k5Ah4fttP1YfGu81XyJUoGtDBjYh9XnbUH8l525FbnJkqbtyO3vHvJ9O8-tdTwsqmOtDPs0KpoepVOy0ewxTXv1-sDu58UYZQZ8UWG0S8Bey8GvzmsZvkh3Wh3YsJOBu8vKO0a-I8h3WQb57ro5_rzWRKCqB6o-mBGE8ukzxrFJ71oRQvX8jxTD0xV33y4o__fjRUTI93idxg-fMN7iI8RjiIdv39Nvv6CcZ624u842d3iavXaUZmB_KUfvtb5K_cb9_jhcamdoe8zuKPTqla8N_A_G8i_KfM08-HXmNlJreJRHZRf3dSv7TMZ3S_kxtaSr826bb2XCdVbRpqJ8nYtkrLntCilFQVI2LKkpZb4uNlUm8oY5azhRNQkqMpGR2ApBm5WsNmWWUduUZdULklAInqTSK62P08q6IVHeL1xnGYnNNtGyYe1Pjk906yUQxTeAq2NW2iyDh0Jo5YO_4QQV9OldcZdW7vFlZIPBvUVbXDyf50-ebTpYPB33j6z78SzOzjaap-jbD5Z7kzQCRrCL-WrZcrI4Xf-Nh0b6l690dvY3bgPQ4aSJBzpcZDnW9GcAAAD__4smE1E">