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

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 7 01:28:29 PDT 2023


================
@@ -314,3 +314,10 @@ typedef struct { struct { int a; struct { struct { int b; } c; int d; } e; } f;
 typedef struct { struct { int a; } b; union { int c; float d; struct { int e; }; }; struct { double f; } g; } PR50990_siblings;
 // CHECK-MESSAGES: :[[@LINE-1]]:1: warning: use 'using' instead of 'typedef'
 // CHECK-FIXES: using PR50990_siblings = struct { struct { int a; } b; union { int c; float d; struct { int e; }; }; struct { double f; } g; };
+
+typedef void (*ISSUE_65055_1)(int);
+typedef bool (*ISSUE_65055_2)(int);
+// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: use 'using' instead of 'typedef'
+// CHECK-FIXES: using ISSUE_65055_1 = void (*)(int);
----------------
PiotrZSL wrote:

use start character in CHECK_FIXES, otherwise this could also match case were typedef is not deleted.
`// CHECK-FIXES: {{^}}using ISSUE_65055_1 = void (*)(int);{{$}}`

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


More information about the cfe-commits mailing list