[clang-tools-extra] [clang-tidy] Preserve comments in `readability-use-std-min-max` (PR #169908)

via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 2 23:20:42 PST 2025


================
@@ -172,13 +171,21 @@ void UseStdMinMaxCheck::check(const MatchFinder::MatchResult &Result) {
 
   auto ReplaceAndDiagnose = [&](const llvm::StringRef FunctionName) {
     const SourceManager &Source = *Result.SourceManager;
+    const std::string Comment =
+        Lexer::getSourceText(
+            CharSourceRange::getCharRange(
+                Lexer::getLocForEndOfToken(If->getRParenLoc(), 0, Source, LO),
+                If->getThen()->getBeginLoc()),
+            Source, LO)
+            .rtrim()
----------------
zeyi2 wrote:

You're right, this is not necessary. Thanks!

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


More information about the cfe-commits mailing list