[PATCH] D133571: [clang-format] Introduce NoFallThrough option into AllowShortCaseLabelsOnASingleLine

Marek Kurdej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 9 06:04:03 PDT 2022


curdeius added inline comments.


================
Comment at: clang/docs/ClangFormatStyleOptions.rst:935
+**AllowShortCaseLabelsOnASingleLine** (``ShortCaseLabelStyle``) :versionbadge:`clang-format 3.6`
+  Determine if Short case labels will be contracted to a single line.
+
----------------



================
Comment at: clang/docs/ClangFormatStyleOptions.rst:3596
 
-      QualifierOrder: ['inline', 'static', 'type', 'const']
+      QualifierOrder: ['inline', 'static' , 'type', 'const']
 
----------------
Unrelated change.


================
Comment at: clang/lib/Format/UnwrappedLineFormatter.cpp:643-657
+    bool NoFallThrough = Style.AllowShortCaseLabelsOnASingleLine ==
+                         FormatStyle::SCLS_NoFallThrough;
+    // If the last thing on the line before was just case X:  then don't merge.
+    if (NoFallThrough && PreviousLine && PreviousLine->Last &&
+        PreviousLine->Last->is(tok::colon))
+      return 0;
+    // Check if the last thing on the line before was an attribute and if so
----------------
Can we merge the conditions like this?


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

https://reviews.llvm.org/D133571



More information about the cfe-commits mailing list