[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:34 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();
----------------
zeyi2 wrote:

Could we use `Lexer::getLocForEndOfToken` for this?

e.g. `Lexer::getLocForEndOfToken(ReplaceRange.getEnd(), 0, SM, LO);`

I think with this API, `bool FunctionPointerCase = false;` is no longer needed :)

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


More information about the cfe-commits mailing list