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

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 2 08:24:41 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()
----------------
vbvictor wrote:

do we just trim right whitespace? do we need it here?

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


More information about the cfe-commits mailing list