[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 15:42:10 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:
> > 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.
> Does there exist the possibility that some developer just include the header and link to library to obtain replacement analysis result for their other parts of program to use, instead of only clangfmt itself is using this class?
Of course the possibility exists, but I don't think there is anyone. And at least for me those aren't the audience. And even then, they can make sure that it's not `SDS_Leave`.


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

https://reviews.llvm.org/D116314



More information about the cfe-commits mailing list