[PATCH] D151761: clang-format: Add AlignConsecutiveShortCaseStatements

Galen Elias via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 6 09:46:38 PDT 2023


galenelias marked 3 inline comments as done.
galenelias added inline comments.


================
Comment at: clang/docs/ClangFormatStyleOptions.rst:798
+
+    case log::info:     return "info:";
+    case log::warning:  return "warning:";
----------------
MyDeveloperDay wrote:
> Do you think the documentation should give examples of the the other cases?
Hmm, I'm not sure what other cases?  Cases where it doesn't align?  In general, for the 'Align*' options we only show examples of the resulting formatting.


================
Comment at: clang/docs/ClangFormatStyleOptions.rst:790
+
+**AlignConsecutiveShortCaseLabels** (``AlignConsecutiveStyle``) :versionbadge:`clang-format 17` :ref:`ΒΆ <AlignConsecutiveShortCaseLabels>`
+  Style of aligning consecutive short case labels.
----------------
MyDeveloperDay wrote:
> HazardyKnusperkeks wrote:
> > MyDeveloperDay wrote:
> > > galenelias wrote:
> > > > MyDeveloperDay wrote:
> > > > > Did you generate this by hand or run the dump_format_style.py function? Format.h and the rst look out of sync
> > > > This was generated from dump_format_style.py.  What looks out of sync?  My guess is the confusing thing is all the styles which use `AlignConsecutiveStyle` get the same documentation pasted for them which specifically references `AlignConsecutiveMacros` and makes it look like it's for the wrong option.
> > > that doesn't feel right to me.. not saying its not dump_format_style.py but it shouldn't do that in my view
> > What shouldn't it be doing?
> > The struct is used for multiple options and the documentation is that ways since we have the struct.
> I understand why its there, I just don't like that the text is repeated and doesn't really reference the case statements, (it could be confusing).
> 
> for example what would `PadOperators` mean in this case
> 
> 
I agree that it's confusing, I've actually gotten confused a few times while reading the documentation for various 'AlignConsecutive*' options.  PadOperators and AlignCompound both explicitly state they only apply to `AlignConsecutiveAssignments`.  Not sure what the fix would be, as this seems to be a fairly by design aspect of the struct sharing with regards to the documentation generation.


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

https://reviews.llvm.org/D151761



More information about the cfe-commits mailing list