diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2023-11-30 20:00:16 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2023-11-30 20:00:16 +0000 |
commit | 703029dbba788f300e679f7512b73257f79499d4 (patch) | |
tree | 48e1505ae9e2042296803606d544857eddaf8932 /clang/lib/Format/WhitespaceManager.cpp | |
parent | fc0a8108a55ae5db3aa0e71a9877bd56f0581728 (diff) |
Vendor import of llvm-project branch release/17.x llvmorg-17.0.6-0-g6009708b4367.vendor/llvm-project/llvmorg-17.0.6-0-g6009708b4367vendor/llvm-project/release-17.x
Diffstat (limited to 'clang/lib/Format/WhitespaceManager.cpp')
-rw-r--r-- | clang/lib/Format/WhitespaceManager.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp index c1016c44a74a..ddb55c4d853a 100644 --- a/clang/lib/Format/WhitespaceManager.cpp +++ b/clang/lib/Format/WhitespaceManager.cpp @@ -1263,6 +1263,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; auto *Start = (Cells.begin() + RowCount * CellDescs.CellCounts[0]); auto *End = Start + Offset; ThisNetWidth = getNetWidth(Start, End, CellDescs.InitialSpaces); @@ -1324,7 +1326,7 @@ void WhitespaceManager::alignArrayInitializersLeftJustified( auto Offset = std::distance(Cells.begin(), CellIter); for (const auto *Next = CellIter->NextColumnElement; Next; Next = Next->NextColumnElement) { - if (RowCount > CellDescs.CellCounts.size()) + if (RowCount >= CellDescs.CellCounts.size()) break; auto *Start = (Cells.begin() + RowCount * CellDescs.CellCounts[0]); auto *End = Start + Offset; |