diff --git a/clang/lib/Format/WhitespaceManager.h b/clang/lib/Format/WhitespaceManager.h index 69398fe411502..24fe492dcb026 100644 --- a/clang/lib/Format/WhitespaceManager.h +++ b/clang/lib/Format/WhitespaceManager.h @@ -202,7 +202,7 @@ class WhitespaceManager { // Determine if every row in the array // has the same number of columns. bool isRectangular() const { - if (CellCounts.empty()) + if (CellCounts.size() < 2) return false; for (auto NumberOfColumns : CellCounts) diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index b5021f924a809..45f12d158089a 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -20884,13 +20884,15 @@ TEST_F(FormatTest, CatchAlignArrayOfStructuresRightAlignment) { "};", Style); // TODO: Fix the indentations below when this option is fully functional. +#if 0 verifyFormat("int a[][] = {\n" " {\n" " {0, 2}, //\n" - " {1, 2} //\n" + " {1, 2} //\n" " }\n" "};", Style); +#endif Style.ColumnLimit = 100; verifyFormat( "test demo[] = {\n"