Set the 'RemoveBracesLLVM' to 'true' which ensures that we avoid curly braces for single-statement bodies in conditional blocks. This option does come with two warnings: This option will be renamed and expanded to support other styles. and Setting this option to true could lead to incorrect code formatting due to clang-format’s lack of complete semantic information. As such, extra care should be taken to review code changes made by this option. The latter seems to be of concern. But since we only use clang-format to verify the format and not to apply formatting, we should be okay here. Signed-off-by: Karthik Nayak <karthik.188@xxxxxxxxx> --- .clang-format | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.clang-format b/.clang-format index 914254a29b..8b75dece80 100644 --- a/.clang-format +++ b/.clang-format @@ -117,6 +117,12 @@ IndentWrappedFunctionNames: false # int *a; PointerAlignment: Right +# Remove optional braces of control statements (if, else, for, and while) +# according to the LLVM coding style. This avoids braces on simple +# single-statement bodies of statements but keeps braces if one side of +# if/else if/.../else cascade has multi-statement body. +RemoveBracesLLVM: true + # Don't insert a space after a cast # x = (int32)y; not x = (int32) y; SpaceAfterCStyleCast: false -- 2.45.1