[clang] [clang-format] Preserve trailing NOLINTEND placement with SeparateDefinitionBlocks (PR #190741)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 17 23:51:43 PDT 2026
================
@@ -291,6 +291,36 @@ TEST_F(DefinitionBlockSeparatorTest, Always) {
"struct E {};",
Style);
+ verifyFormat("// NOLINTBEGIN\n"
+ "int x = 1;\n"
+ "int y = 2;\n"
+ "// NOLINTEND\n"
+ "\n"
+ "void some_function() {}\n",
+ Style,
+ "// NOLINTBEGIN\n"
+ "int x = 1;\n"
+ "int y = 2;\n"
+ "// NOLINTEND\n"
+ "\n"
+ "void some_function() {}\n",
+ false);
----------------
owenca wrote:
```suggestion
constexpr StringRef Code("// NOLINTBEGIN\n"
"int x = 1;\n"
"int y = 2;\n"
"// NOLINTEND\n"
"\n"
"void some_function() {}");
verifyFormat(Code, Style, Code);
```
Please note that we usually don't append a newline at the end of a test case.
https://github.com/llvm/llvm-project/pull/190741
More information about the cfe-commits
mailing list