================
@@ -1444,16 +1444,22 @@ WhitespaceManager::CellDescriptions 
WhitespaceManager::getCells(unsigned Start,
       } else if (C.Tok->is(tok::comma)) {
         if (!Cells.empty())
           Cells.back().EndIndex = i;
-        if (C.Tok->getNextNonComment()->isNot(tok::r_brace)) // dangling comma
+
+        if (const auto *Next = C.Tok->getNextNonComment();
+            Next && Next->isNot(tok::r_brace)) { // dangling comma
           ++Cell;
+        }
       }
     } else if (Depth == 1) {
       if (C.Tok == MatchingParen) {
         if (!Cells.empty())
           Cells.back().EndIndex = i;
         Cells.push_back(CellDescription{i, ++Cell, i + 1, false, nullptr});
-        CellCounts.push_back(C.Tok->Previous->isNot(tok::comma) ? Cell + 1
-                                                                : Cell);
+        CellCounts.push_back(
+            C.Tok->Previous->isNot(tok::comma) &&
+                    !MatchingParen->MatchingParen->Previous->is(tok::equal)
----------------
HazardyKnusperkeks wrote:

```suggestion
                    MatchingParen->MatchingParen->Previous->isNot(tok::equal)
```
`MatchingParen->MatchingParen` shouldn't we be back where we started? Whatever 
is going on here, I think a comment would be helpful.

https://github.com/llvm/llvm-project/pull/77045
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to