mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-04-04 06:12:19 +00:00
clang-format: Do not use two-argument/operand special case with no alignment
Without alignment, there is no clean separation between the arguments, even if there are only two. Before: aaaaaaaaaaaaaa( aaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); After: aaaaaaaaaaaaaa(aaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa); llvm-svn: 293875
This commit is contained in:
parent
3b008536f3
commit
c3aa05c01b
@ -429,7 +429,7 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun,
|
||||
// does not help.
|
||||
bool HasTwoOperands =
|
||||
P->OperatorIndex == 0 && !P->NextOperator && !P->is(TT_ConditionalExpr);
|
||||
if ((!BreakBeforeOperator && !HasTwoOperands) ||
|
||||
if ((!BreakBeforeOperator && !(HasTwoOperands && Style.AlignOperands)) ||
|
||||
(!State.Stack.back().LastOperatorWrapped && BreakBeforeOperator))
|
||||
State.Stack.back().NoLineBreakInOperand = true;
|
||||
}
|
||||
|
@ -4163,6 +4163,10 @@ TEST_F(FormatTest, EnforcedOperatorWraps) {
|
||||
TEST_F(FormatTest, NoOperandAlignment) {
|
||||
FormatStyle Style = getLLVMStyle();
|
||||
Style.AlignOperands = false;
|
||||
verifyFormat("aaaaaaaaaaaaaa(aaaaaaaaaaaa,\n"
|
||||
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +\n"
|
||||
" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);",
|
||||
Style);
|
||||
Style.BreakBeforeBinaryOperators = FormatStyle::BOS_NonAssignment;
|
||||
verifyFormat("bool value = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
||||
" + aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user