[clang-tools-extra] [clang-tidy][modernize-use-using]fix function pointer typedef correctly (PR #65558)

Congcong Cai via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 7 02:01:30 PDT 2023


HerrCai0907 wrote:

> This is weird issues because it always happen when two typedefs are one after other.

```c++
typedef void (*ISSUE_65055_1)(int);
typedef bool (*ISSUE_65055_2)(int);
typedef void VOID;
```
The typedef matcher will match following position:

```
TypedefDecl 0x1610ba960 <ID/test.cpp:1:1, col:34> col:16 ISSUE_65055_1 'void (*)(int)'
TypedefDecl 0x1610bab30 <line:2:1, col:34> col:16 ISSUE_65055_2 'bool (*)(int)'
TypedefDecl 0x1610bab98 <line:3:1, col:14> col:14 VOID 'void'
```
That means typedef normal type is from `typedef` to the end of original type but for function pointer is from `typedef` to the end.



https://github.com/llvm/llvm-project/pull/65558


More information about the cfe-commits mailing list