[clang] [clang-format] Add BreakBinaryOperations configuration (PR #95013)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 4 23:36:53 PDT 2024


================
@@ -146,6 +147,33 @@ static bool startsNextParameter(const FormatToken &Current,
            Style.BreakInheritanceList != FormatStyle::BILS_BeforeComma));
 }
 
+// Returns \c true if \c Token in an alignable binary operator
+static bool isAlignableBinaryOperator(const FormatToken &Token) {
+  // No need to align binary operators that only have two operands.
+  bool HasTwoOperands = Token.OperatorIndex == 0 && !Token.NextOperator &&
+                        Token.isNot(TT_ConditionalExpr);
----------------
owenca wrote:

This is unnecessary because `TT_BinaryOperator` below ensures not `TT_ConditionalExpr `.

https://github.com/llvm/llvm-project/pull/95013


More information about the cfe-commits mailing list