[cfe-dev] [clang-format] add {} around statement after if() while() for()

phi clang via cfe-dev cfe-dev at lists.llvm.org
Wed Jan 27 18:44:02 PST 2016


Hi,

I'd like to know if clang-format could be setup to reduce
non-compound_statement into { non-compound_statement; } in
iteration_statement.

statement
: labeled_statement
| compound_statement
| expression_statement
| selection_statement
| iteration_statement
| jump_statement
;
iteration_statement
: WHILE '(' expression ')' statement
| DO statement WHILE '(' expression ')' ';'
| FOR '(' expression_statement expression_statement ')' statement
| FOR '(' expression_statement expression_statement expression ')' statement
;

i.e for construct like if(exp)foo=1; I'd like to get if(exp){foo=1;} Then
the beautifier would indent as needed.

Thanx in advance Cheers, Phi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160128/a8d8353a/attachment.html>


More information about the cfe-dev mailing list