[clang] [clang-format] extend clang-format directive with options to prevent formatting for one line (PR #118566)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 18 02:01:19 PST 2024


================
@@ -144,7 +144,8 @@ void DefinitionBlockSeparator::separateBlocks(
         return false;
 
       if (const auto *Tok = OperateLine->First;
-          Tok->is(tok::comment) && !isClangFormatOn(Tok->TokenText)) {
+          Tok->is(tok::comment) && parseClangFormatDirective(Tok->TokenText) ==
+                                       ClangFormatDirective::None) {
----------------
HazardyKnusperkeks wrote:

Wouldn't it have to be
```suggestion
          Tok->is(tok::comment) && parseClangFormatDirective(Tok->TokenText) !=
                                       ClangFormatDirective::On) {
```

Otherwise you change the meaning, right?

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


More information about the cfe-commits mailing list