[PATCH] D12362: [clang-format] Add support of consecutive declarations alignment

Daniel Jasper via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 29 08:10:29 PDT 2015


djasper added inline comments.

================
Comment at: lib/Format/WhitespaceManager.cpp:270
@@ +269,3 @@
+      if (Changes[i].NewlinesBefore > 1 || !FoundDeclarationOnLine ||
+          FoundLeftBraceOnLine || FoundLeftParenOnLine) {
+        AlignSequence();
----------------
Generally, we don't use braces for single-statement-ifs in LLVM style.

================
Comment at: unittests/Format/FormatTest.cpp:8699
@@ +8698,3 @@
+                   Alignment));
+  Alignment.AlignConsecutiveAssignments = true;
+  verifyFormat("float      something = 2000;\n"
----------------
Can you add a case (unless I missed it) where aligning both consecutive assignments and consecutive declarations exceed the column limit? What should happen in that case? I am thinking of something like:

  int loooooooooooooooongName = 1;
  LoooooooooooongType i = bbbbbbbbbbbbbbbbbbbbbbb;


http://reviews.llvm.org/D12362





More information about the cfe-commits mailing list