[clang] [clang-format] Preserve trailing NOLINTEND placement with SeparateDefinitionBlocks (PR #190741)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 17 01:59:51 PDT 2026


================
@@ -148,7 +148,10 @@ void DefinitionBlockSeparator::separateBlocks(
 
       if (const auto *Tok = OperateLine->First;
           Tok->is(tok::comment) && !isClangFormatOn(Tok->TokenText)) {
-        return true;
+        const bool IsEndComment =
+            Tok->NewlinesBefore == 1 && OperateIndex + 1 < Lines.size() &&
+            Lines[OperateIndex + 1]->First->NewlinesBefore > 1;
+        return !IsEndComment;
----------------
owenca wrote:

```suggestion
        if (!IsEndComment)
          return true;
```
as it never returned `false` before.

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


More information about the cfe-commits mailing list