owenca wrote: > > Would `__attribute__((noreturn))`, `if ((i = j))`, `decltype((x))`, and > > `while (((i + 1) * j - 2) * k > 3)` be formatted as `__attribute__(( > > noreturn ))`, `if (( i = j ))`, `decltype(( x ))`, and `while ( ( ( i + 1 ) > > * j - 2 ) * k > 3 )`, respectively? > > Almost, it would also be `if ( ( i = j ) )`, Although repeated parens are > typically removed. So a better example is `if ( ( i = j ) && ( k > 3 ) )` > > We don't have `decltype` in our C code base. I can add support for it as an > option if desired. > > We also have cases such as `__attribute__(( __aligned__( x ) ))`
I'm ok with all of the above except for `if ( ( i = j ) )`, which should be formatted as `if (( i = j ))` because the extra pair of parentheses is not superfluous. This is similar to `decltype(( x))`, and the`RemoveParentheses` option doesn't strip the extra pair for either. It seems adding a boolean sub-option that targets double pairs of parentheses as I suggested before is feasible although a better name than `ConsecutiveParentheses` may be needed. https://github.com/llvm/llvm-project/pull/77522 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits