[PATCH] D101868: [clang-format] Adds a formatter for aligning arrays of structs

Fred Grim via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 3 09:39:54 PDT 2021


feg208 added a comment.

Got both of these



================
Comment at: clang/lib/Format/TokenAnnotator.cpp:737-740
+    const auto End = Contexts.rbegin() + 2;
+    auto Last = Contexts.rbegin();
+    unsigned Depth = 0;
+    for (; Last != End; Last = std::next(Last)) {
----------------
HazardyKnusperkeks wrote:
> I actually meant so. Because now this is even safe if the iterators are not random access anymore in the future.
Oh I see. I sort of wondered about that but it didn't seem like a hill to die on.


================
Comment at: clang/lib/Format/WhitespaceManager.cpp:1136-1137
+        auto j = i - 1;
+        for (; j > 0 && Changes[j].NewlinesBefore == 0; --j) {
+        }
+        EndSpaces = Changes[j].Spaces;
----------------
HazardyKnusperkeks wrote:
> I don't know how to do this in LLVM style, but maybe so?
So long as clang-format doesn't complain I am fine either way


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101868



More information about the cfe-commits mailing list