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

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

generally the design of clang-format is to only make formatting changes, not adding or removing tokens (there are some exceptions to this, like wrapping string literals). I believe the intent/desire is to have higher level linting operations built on top of clang-format, in clang-tidy or similar.