[clang] [clang-format] Preserve trailing NOLINTEND placement with SeparateDefinitionBlocks (PR #190741)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 18 02:41:28 PDT 2026
================
@@ -290,7 +290,20 @@ TEST_F(DefinitionBlockSeparatorTest, Always) {
"\n"
"struct E {};",
Style);
-
+ constexpr StringRef Code("// NOLINTBEGIN\n"
+ "int x = 1;\n"
+ "int y = 2;\n"
+ "// NOLINTEND\n"
+ "\n"
+ "void some_function() {}");
+ verifyFormat(Code, Style, Code);
+ constexpr StringRef Code2("int x = 0;\n"
+ "int y = 0;\n"
+ "// trailing comment 1\n"
+ "// trailing comment 2\n"
+ "\n"
+ "void some_function() {}\n");
+ verifyFormat(Code2, Style, Code2);
----------------
owenca wrote:
```suggestion
"void some_function() {}");
verifyFormat(Code2, Style, Code2);
```
https://github.com/llvm/llvm-project/pull/190741
More information about the cfe-commits
mailing list