[clang-tools-extra] [clang-tidy] Correct fix-it range for function pointer-like typedef in `modernize-use-using` (PR #173751)

via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 27 20:24:36 PST 2025


================
@@ -437,3 +437,22 @@ namespace GH97009 {
 // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use 'using' instead of 'typedef' [modernize-use-using]
 // CHECK-FIXES: using Function = bool (*)(PointType, PointType);
 }
+
+namespace GH173732 {
+  // reference to array
+  typedef char (&refarray)[2];
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use 'using' instead of 'typedef' [modernize-use-using]
+  // CHECK-FIXES: using refarray = char (&)[2];
+  typedef char &ref;
+  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use 'using' instead of 'typedef' [modernize-use-using]
+  // CHECK-FIXES: using ref = char &;
+
+
----------------
zeyi2 wrote:

Nit: Could we add tests that look like:
```c++
typedef char (&refArray)[2], (*ptrArray)[2];
```

(Although generating the correct `CHECK-FIXES` for this may be out of scope for this PR...)

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


More information about the cfe-commits mailing list