[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
Sun Dec 28 04:15:37 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:

Update: i think that should be done in another PR, because there are also cases like:
```
  typedef char x1, (&refArray)();
```
It provides wrong fix-its right now (before PR), although it's not very common (multi function pointers seem to me too)

So i will keep the old way here since it will not provide wrong fix-its for multi function pointer typedef cases comparing to `getLocForEndOfToken`.

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


More information about the cfe-commits mailing list