[PATCH] D116314: [clang-format] Add style to separate definition blocks

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 31 12:09:40 PST 2021


HazardyKnusperkeks added inline comments.


================
Comment at: clang/lib/Format/DefinitionBlockSeparator.cpp:25
+    FormatTokenLexer &Tokens) {
+  if (Style.SeparateDefinitionBlocks == FormatStyle::SDS_Leave)
+    return {{}, 0};
----------------
ksyx wrote:
> HazardyKnusperkeks wrote:
> > Better, but I still think we should have the assert here. The class should not be instantiated at all, if you don't want to use it.
> My idea is that it would be too redundant to have every user of this method to check style once before it calls it?
Who are the users? `clang-format` and maybe its tests. And the only one that really matters is `clang-format`, which does the check.


================
Comment at: clang/unittests/Format/DefinitionBlockSeparatorTest.cpp:45
+
+  static void verifyFormat(llvm::StringRef Code,
+                           const FormatStyle &Style = getLLVMStyle(),
----------------
Maybe one should either use the normal reformat function, or additionally. Because right now we do not test any interferences of these two functions.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116314/new/

https://reviews.llvm.org/D116314



More information about the cfe-commits mailing list