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

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 3 01:10:11 PDT 2021


HazardyKnusperkeks added inline comments.


================
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)) {
----------------
I actually meant so. Because now this is even safe if the iterators are not random access anymore in the future.


================
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;
----------------
I don't know how to do this in LLVM style, but maybe so?


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