[clang-tools-extra] [clang-tidy] Fix assert failure in modernize-use-std-format when args are in macros (PR #176684)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 19 01:46:38 PST 2026


================
@@ -800,10 +800,11 @@ void FormatStringConverter::applyFixes(DiagnosticBuilder &Diag,
   }
 
   for (const auto &[ArgIndex, Replacement] : ArgFixes) {
-    const SourceLocation AfterOtherSide =
-        utils::lexer::findNextTokenSkippingComments(Args[ArgIndex]->getEndLoc(),
-                                                    SM, LangOpts)
-            ->getLocation();
+    const auto NextToken = utils::lexer::findNextTokenSkippingComments(
+        Args[ArgIndex]->getEndLoc(), SM, LangOpts);
+    if (!NextToken)
+      continue;
----------------
zeyi2 wrote:

Seems that it was not flagged.. (https://github.com/llvm/llvm-project/pull/170004/files)

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


More information about the cfe-commits mailing list