[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:50 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;
----------------
owenca wrote:

Use `NextLine` here:
```suggestion
            Tok->NewlinesBefore == 1 && NextLine && NextLine->First->NewlinesBefore > 1;
```

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


More information about the cfe-commits mailing list