[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:49:06 PST 2025


================
@@ -205,8 +208,7 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) {
   }
 
   if (!ReplaceRange.getEnd().isMacroID()) {
-    const SourceLocation::IntTy Offset =
-        MatchedDecl->getFunctionType() ? 0 : Name.size();
+    const SourceLocation::IntTy Offset = FunctionPointerCase ? 0 : Name.size();
----------------
flovent wrote:

Good catch.

It's suitable for one function pointer-like alias in typedef. But it will provides wrong fix for `typedef char (&refArray)[2], (*ptrArray)[2];`, i will see if that's easy to fix:
```
# | -  typedef char (&refArray)[2], (*ptrArray)[2];
# | +  using refArray = char (&)[2];
# | +using ptrArray = char (&refArray)[2], (*)[2];
```

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


More information about the cfe-commits mailing list