[clang] [clang-format] Fix crashes in AlignArrayOfStructures (PR #72520)

Owen Pan via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 16 15:15:04 PST 2023


================
@@ -1316,6 +1316,8 @@ void WhitespaceManager::alignArrayInitializersRightJustified(
         auto Offset = std::distance(Cells.begin(), CellIter);
         for (const auto *Next = CellIter->NextColumnElement; Next;
              Next = Next->NextColumnElement) {
+          if (RowCount >= CellDescs.CellCounts.size())
+            break;
----------------
owenca wrote:

I intentionally made it the same as lines 1384-1385 below so that lines 1315-1323 would remain copy-pasted from lines 1380-1388. This will make future refactoring easier.

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


More information about the cfe-commits mailing list