[PATCH] D93986: [clang-format] Add the possibility to align assignments spanning empty lines or comments

Lukas Barth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 5 03:32:49 PST 2021


tinloaf marked 2 inline comments as done.
tinloaf added inline comments.


================
Comment at: clang/docs/ClangFormatStyleOptions.rst:198
 
-**AlignConsecutiveAssignments** (``bool``)
-  If ``true``, aligns consecutive assignments.
+**AlignConsecutiveAssignments** (``AlignConsecutiveAssignmentsStyle``)
+  Style of aligning assignments on consecutive lines.
----------------
MyDeveloperDay wrote:
> As you plan to do the other cases won't this introduce
> 
> `AlignBitFieldStyle`
> and
> `AlignMacroStyle`
> 
> why not have 1  `AlignConsecutiveStyle` that can be used for all 3, then you don't need the other enum `TokenAlignmentStyle ` which means you won't need to map from one to the other?
Yes, it would. I was under the assumption that every multiple-choice option in the options should have its own enum, for type safety. But yes, that would be way more elegant (and make the diff much smaller). I'll change it!


================
Comment at: clang/include/clang/Format/Format.h:117
+    ///   int b    = 23;
+    ///
+    ///   int ccc  = 23;
----------------
MyDeveloperDay wrote:
> tinloaf wrote:
> > HazardyKnusperkeks wrote:
> > > You are adding a Tab here, or do I misinterpret this? Shouldn't that be fixed by clang-format itself?
> > I'm not sure, honestly. I did auto-format everything using `clang-format` with the provided style. I think I know what you mean (the little double arrows here in the side-by-side view?), but if I open the raw diff ("View Options" above, "Show Raw File (Right)"), it does not seem to contain tabs. Also, the file on my disk does not contain tabs.
> @HazardyKnusperkeks to my knowledge, its not a tab
Great, I'll mark this as done then.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93986/new/

https://reviews.llvm.org/D93986



More information about the cfe-commits mailing list