Hi,
I’d like to add an additional rule to clang-format.
Namely, I’d like to have an option to surround short if statements and short loops with braces ‘{’, ‘}’.
What’s the best way to do it, i.e. to add an additional token (here, tok::l_brace and tok::r_brace)?
Regards,
Marek Kurdej
That’s out of scope for clang-format. Clang-format is designed to only make whitespace changes, not to introduce or remove tokens.
Clang-tidy is the next project (in very early stages) layered on top of clang-format that will make the kind of changes you’re talking about.
Hi,
I’d like to add an additional rule to clang-format.
Namely, I’d like to have an option to surround short if statements and short loops with braces ‘{’, ‘}’.
What’s the best way to do it, i.e. to add an additional token (here, tok::l_brace and tok::r_brace)?
Regards,
Marek Kurdej