https://github.com/mikecrowe created https://github.com/llvm/llvm-project/pull/91071
Include the source range of the printf function in the diagnostic so it gets underlined in the output. >From d0ccc6ade357155161977446b64c50cafa100edb Mon Sep 17 00:00:00 2001 From: Mike Crowe <m...@mcrowe.com> Date: Sat, 4 May 2024 17:41:37 +0100 Subject: [PATCH] [clang-tidy] Improve modernize-use-std-print diagnostic Include the source range of the printf function in the diagnostic so it gets underlined in the output. --- clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp index 660996aba7b70d..aa60c904a363da 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp @@ -138,7 +138,8 @@ void UseStdPrintCheck::check(const MatchFinder::MatchResult &Result) { if (!Converter.canApply()) { diag(PrintfCall->getBeginLoc(), "unable to use '%0' instead of %1 because %2") - << ReplacementFunction << OldFunction->getIdentifier() + << PrintfCall->getSourceRange() << ReplacementFunction + << OldFunction->getIdentifier() << Converter.conversionNotPossibleReason(); return; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits