[clang] [clang-format]: Split alignment of declarations around assignment (PR #69340)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 17 13:27:58 PDT 2023


================
@@ -973,13 +974,51 @@ void WhitespaceManager::alignConsecutiveShortCaseStatements() {
                              Changes);
 }
 
-void WhitespaceManager::alignConsecutiveDeclarations() {
+void WhitespaceManager::alignConsecutiveDeclarationsPreAssignment() {
   if (!Style.AlignConsecutiveDeclarations.Enabled)
     return;
 
   AlignTokens(
       Style,
       [](Change const &C) {
+        for (FormatToken *Prev = C.Tok->Previous; Prev; Prev = Prev->Previous)
----------------
HazardyKnusperkeks wrote:

Could you extract that check and use the same function for the alignment? I'd not like the code duplication.

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


More information about the cfe-commits mailing list