5
我想知道是否可以設置clang格式以將非compound_statement
減少爲iteration_statement
中的{ non-compound_statement; }
。clang-format if()while()for()if()while()for()
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
;
例
輸入:
if (exp) foo = 1;
輸出:
if (exp) { foo = 1; }
然後將凹痕作爲所需的美化。
鐺格式可能不是你要找的內容。你有沒有嘗試過使用'clang-tidy'? – PythonJin