[clang] [clang-format] Separate License text and include blocks (PR #77918)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 12 12:01:59 PST 2024


================
@@ -65,18 +81,18 @@ void DefinitionBlockSeparator::separateBlocks(
     }
     return false;
   };
-  unsigned NewlineCount =
-      (Style.SeparateDefinitionBlocks == FormatStyle::SDS_Always ? 1 : 0) + 1;
+  unsigned NewlineCount = getNewlineCount(Style.SeparateDefinitionBlocks);
   WhitespaceManager Whitespaces(
       Env.getSourceManager(), Style,
       Style.LineEnding > FormatStyle::LE_CRLF
           ? WhitespaceManager::inputUsesCRLF(
                 Env.getSourceManager().getBufferData(Env.getFileID()),
                 Style.LineEnding == FormatStyle::LE_DeriveCRLF)
           : Style.LineEnding == FormatStyle::LE_CRLF);
+  std::optional<bool> inLicenseText{};
----------------
HazardyKnusperkeks wrote:

You don't use this as optional, just as plain `bool` (`has_value`), so something isn't right.

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


More information about the cfe-commits mailing list