[llvm-bugs] [Bug 52085] New: Interaction between BraceWrapping/AfterCaseLabel and IndentCaseBlocks should be documented

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 5 10:01:25 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52085

            Bug ID: 52085
           Summary: Interaction between BraceWrapping/AfterCaseLabel and
                    IndentCaseBlocks should be documented
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Formatter
          Assignee: unassignedclangbugs at nondot.org
          Reporter: stolze at de.ibm.com
                CC: djasper at google.com, klimek at google.com,
                    llvm-bugs at lists.llvm.org

In our project, we are using the following configuration for clang-format:

BreakBeforeBraces: Custom
BraceWrapping:
  AfterCaseLabel: false
IndentCaseBlocks: true

Due to "IndentCaseBlocks: true", it does not matter what "AfterCaseLabel" is
set to. The formatting will always result is such a change:

                switch ( enumValue ) {
-               case Enum::Value1: {
+               case Enum::Value1:
+                       {
                                doSomething();

This behavior is pretty logical. I suggest to improve the documentation for
AfterCaseLabel. For example, adding a sentence like this helps to avoid users
wondering why "AfterCaseLabel: false" and "AfterCaseLabel: true" show the same
behavior:
> AfterCaseLabel is ignored if IndentCaseBlocks is set to true.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211005/89aa6634/attachment.html>


More information about the llvm-bugs mailing list