[clang] [clang-format] Fix crashes in AlignArrayOfStructures (PR #72520)
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 16 10:48:10 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;
----------------
HazardyKnusperkeks wrote:
```suggestion
for (const auto *Next = CellIter->NextColumnElement; Next && RowCount < CellDescs.CellCounts.size();
Next = Next->NextColumnElement, ++RowCount) {
```
Maybe?
Then the `++RowCount` below must be removed.
https://github.com/llvm/llvm-project/pull/72520
More information about the cfe-commits
mailing list