[clang-format] Inherit RightAlign options across scopes
authorEmilia Dreamer <emilia@rymiel.space>
Wed, 11 Jan 2023 03:56:08 +0000 (05:56 +0200)
committerEmilia Dreamer <emilia@rymiel.space>
Wed, 11 Jan 2023 03:59:45 +0000 (05:59 +0200)
commit51ba660a0700e659e1a97f3ca5879b8617ec5c26
tree16899fec39a476119500e31d1a835249562ea6bc
parent57a366be1e772ab805aa13a33f9e7bc687dd306d
[clang-format] Inherit RightAlign options across scopes

D119599 added the ability to align compound assignments, right aligning
them in order to line up at the equals sign.
However, that patch didn't account for AlignTokens being called
recursively across scopes, which reset the right justification to be
false in any scope besides the top scope. This meant the compound
assignments were aligned, just not at the right place.
(No tests also ever introduced any scopes)

This patch makes sure to inherit the right justification value, just as
every other parameter is passed on.

Fixes https://github.com/llvm/llvm-project/issues/58029

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D141288
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp