aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineOperand.cpp
diff options
context:
space:
mode:
authorKrasimir Georgiev <krasimir@google.com>2020-06-24 12:55:05 +0200
committerKrasimir Georgiev <krasimir@google.com>2020-06-24 13:11:18 +0200
commit0fad648b65b99b68040fa26c5da9c0bec5b0aa1d (patch)
tree96068d088df53f88afbf0111da72554b5eb74800 /llvm/lib/CodeGen/MachineOperand.cpp
parent31fe8c2763a8982e16646f85ac09f2362341306c (diff)
downloadllvm-0fad648b65b99b68040fa26c5da9c0bec5b0aa1d.zip
llvm-0fad648b65b99b68040fa26c5da9c0bec5b0aa1d.tar.gz
llvm-0fad648b65b99b68040fa26c5da9c0bec5b0aa1d.tar.bz2
[clang-format] restore indent in conditionals when AlignOperands is DontAlign
Summary: After D50078, we're experiencing unexpected un-indent using a style combining `AlignOperands: DontAlign` with `BreakBeforeTernaryOperators: false`, such as Google's JavaScript style: ``` % bin/clang-format -style=google ~/test.js aaaaaaaaaaa = bbbbbbbb ? cccccccccccccccccc() : dddddddddd ? eeeeeeeeeeeeee : fffff; ``` The issue lies with the interaction of `AlignOperands: DontAlign` and the edited code section in ContinuationIndenter.cpp, which de-dents the intent by `Style.ContinuationIndentWidth`. From [[ https://github.com/llvm/llvm-project/blob/ac3e5c4d93fbe7fb2db3c745c721aff41cc1b851/clang/include/clang/Format/Format.h#L170 | the documentation ]] of AlignOperands: DontAlign: > The wrapped lines are indented `ContinuationIndentWidth` spaces from the start of the line. So the de-dent effectively erases the necessary `ContinuationIndentWidth` in that case. This patch restores the `AlignOperands: DontAlign` behavior, producing: ``` % bin/clang-format -style=google ~/test.js aaaaaaaaaaa = bbbbbbbb ? cccccccccccccccccc() : dddddddddd ? eeeeeeeeeeeeee : fffff; ``` Reviewers: sammccall Reviewed By: sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D82199
Diffstat (limited to 'llvm/lib/CodeGen/MachineOperand.cpp')
0 files changed, 0 insertions, 0 deletions