HomePhabricator

[clang-format] Add IndentCaseBlocks option

Authored by MyDeveloperDay on Jan 19 2020, 7:52 AM.

Description

[clang-format] Add IndentCaseBlocks option

Summary:
The documentation for IndentCaseLabels claimed that the "Switch
statement body is always indented one level more than case labels". This
is technically false for the code block immediately following the label.
Its closing bracket aligns with the start of the label.

If the case label are not indented, it leads to a style where the
closing bracket of the block aligns with the closing bracket of the
switch statement, which can be hard to parse.

This change introduces a new option, IndentCaseBlocks, which when true
treats the block as a scope block (which it technically is).

(Note: regenerated ClangFormatStyleOptions.rst using tools/dump_style.py)

Reviewed By: MyDeveloperDay

Patch By: capn

Tags: #clang-format, #clang

Differential Revision: https://reviews.llvm.org/D72276

Details

Committed
MyDeveloperDayJan 19 2020, 7:52 AM
Reviewer
MyDeveloperDay
Differential Revision
D72276: [clang-format] Add IndentCaseBlocks option
Parents
rGd82adf328fb5: Allow space after C-style cast in C# code
Branches
Unknown
Tags
Unknown