================
@@ -218,6 +218,18 @@ void UseStdMinMaxCheck::check(const 
MatchFinder::MatchResult &Result) {
       if (Semi != StringRef::npos && PostInner.take_front(Semi).trim().empty())
         PostInner = PostInner.drop_front(Semi + 1);
       AppendNormalized(PostInner);
+    } else {
+      // Non-compound case: find the trailing semicolon after the expression
+      // and capture any comments between the expression end and the
+      // semicolon.
+      std::optional<Token> SemiTok = Lexer::findNextToken(
----------------
zeyi2 wrote:

Nit: `findNextToken` already calls `getLocForEndOfToken` inside, so we can 
simplify this to:

```cpp
if (const auto SemiTok =
        Lexer::findNextToken(ThenLocation, Source, LO);
    SemiTok && SemiTok->is(tok::semi)) {
  AppendNormalized(
      GetSourceText(ThenLocation, SemiTok->getLocation()).rtrim());
  ThenLocation = SemiTok->getLocation();
}
```

Also, please remove the verbose comments.

```diff
-      // Non-compound case: find the trailing semicolon after the expression
-      // and capture any comments between the expression end and the
-      // semicolon.
```

https://github.com/llvm/llvm-project/pull/208782
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to