[PATCH] D121069: [clang-format] Minimize the damage caused by AlignArrayOfStructures when working on non square arrays

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 6 08:36:03 PST 2022


MyDeveloperDay updated this revision to Diff 413301.
MyDeveloperDay marked 2 inline comments as done.
MyDeveloperDay added a comment.

There were no checks for if the cell would run off the end of the CellDescs structure, this is part of the reason for the crashes that the PrevIter->Index becomes invalid and is then used to index into the Changes.

The code just assumed it knew how many rows and columns there were, but in some circumstances it gets it wrong and just keeps going. This MaxRows check should at least prevent that by ensuring we just don't keep going off the end of the rows. (this was the final crash)

Added a warning to the documentation.

F22348813: image.png <https://reviews.llvm.org/F22348813>


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121069/new/

https://reviews.llvm.org/D121069

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/include/clang/Format/Format.h
  clang/lib/Format/WhitespaceManager.cpp
  clang/lib/Format/WhitespaceManager.h
  clang/unittests/Format/FormatTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121069.413301.patch
Type: text/x-patch
Size: 12145 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220306/258a8e3c/attachment-0001.bin>


More information about the cfe-commits mailing list